Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Alignment is working only sometimes in editor made in java.  RSS feed

 
charmi chavda
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to this forum.I had made a simple editor in java and embed it in jsp.I want to add alignment option to it but it is not working some times.SO please help me.Any help will be appreciated.
Below is the method which load the file in editor from database.

below is the code for alignment.


Than you in advance
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "embed in JSP" mean - is this part of an applet or WebStart application?

It should go without saying, but ignoring exceptions is almost always a bad idea.
 
Rob Camick
Ranch Hand
Posts: 2800
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The AlignmentAction should be used to create your button (or menu item):



If you need more help then post your SSCCE that demonstrates the problem.
 
charmi chavda
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ulf Dittmer,

Actually its an applet.But m using this applet in a web application so m embeding this applet's signed jar file via <applet></applet> into jsp page.Thanks for reply.
 
charmi chavda
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Rob Camick ,
Actually i don't know where the problem is thats why i had included code that i suspects the problem will be.Yes alignment action will be applied by JButton on toolbar.Thanks for reply.
 
Rob Camick
Ranch Hand
Posts: 2800
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats why i had included code that i suspects the problem will be


I don't think you understood my suggestion. You don't need to create an ActionListener for the button.

Yyou still haven't posted a SSCCE, so I can't tell if you are doing it correctly or not.
 
charmi chavda
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Rob Camick,
what do you mean by SSCCE-short self contained, correct example .Means what other code you need that will reveal you the problem?I am storing the editor's content into database and also retrieving it from the database.and after that when i am trying to implement alignment to the retrieved data it will not work.If i will just write the code in editor and then apply alignment and then save it then alignment is working.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what is different between retrieving the alignment information from the DB vs. using it directly in the app?

What Rob is asking you to post is an example code that clearly demonstrates the problem, yet is as short as possible, so that we (the people looking at the code) don't get confused by irrelevant code.
 
charmi chavda
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ulf Dittmer ,

I had posted here the code of my editor.



here is the code for embeddinf this applet after making jar file to jsp



hope this will help you.If you comment line number 50.then this will run as a standalone java program.
 
charmi chavda
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ulf Dittmer ,

"So what is different between retrieving the alignment information from the DB vs. using it directly in the app? "
I also don't know why it is happening but it is happening.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's way too much code to read through and make sense of. What's more, most of it is likely irrelevant to the problem at hand. Please read up on what an SSCCE is, especially what the first "S" stands for.

I also don't know why it is happening but it is happening.

How have you tried to debug this problem?
 
charmi chavda
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is the sentence for center alignment.StyledEditorKit provide alignment action.So I am using that in built functionallity.Now how could i debug that ???I had seen output before and after applying alignment sometimes alignment is changed and sometimes it remains as it is.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!