• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need Help in Swing  RSS feed

 
Kishen Singh Punjabi
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the prompt Response.!!!

I have a Swing App which shoots email..
In the JTextArea I enter:
Hi Customer,

Thank You For calling our bank.

I see that your acount balance is XXX.
Blah
Blah
Blah

Thank You,
Hrithik

I want it in the same format I entered because I'm passing it to message body Content.Please post your suggestions on how I should do this..
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the getText() method of the JTextArea sounds ideal to me.
 
Kishen Singh Punjabi
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

I have a question in Swings,

I have a text Area,beside it I want to have a button on click of Which- open a document-model dialog with TextArea/anything Like that, prepopulated with the content from the beside TextArea.

When I edit and click OK on the document-modal the content in the TextArea shuold be the same entered in document-modal.

Any Suggestions on how to do it..

Thanks in Advance
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hrithik, might I suggest that asking random questions on a forum isn't a good way of learning? Swing (not "Swings") is a complicated subject and you aren't going to get anywhere if you try to learn it that way. Here's a link to Oracle's tutorial: Trail: Creating a GUI With JFC/Swing. You'll find there is a lot of information there, and it's going to take a while for you to go through it.
 
Kishen Singh Punjabi
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Hrithik, might I suggest that asking random questions on a forum isn't a good way of learning? Swing (not "Swings") is a complicated subject and you aren't going to get anywhere if you try to learn it that way. Here's a link to Oracle's tutorial: Trail: Creating a GUI With JFC/Swing. You'll find there is a lot of information there, and it's going to take a while for you to go through it.


Thanks,

I have a Jframe with button in it clicking on which opens an other Jframe,while I am editing in Second JFrame my first JFrame should be visible but should not be ACCESSBLE.

Please suggest how to do it.

Thanks
 
Rob Spoor
Sheriff
Posts: 20898
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a modal JDialog instead of a second JFrame.
 
Kishen Singh Punjabi
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Use a modal JDialog instead of a second JFrame.


FIRST:
String str = queryTextArea.getText();
final JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Sans-Serif", Font.PLAIN, 12));
textArea.setText(str);
textArea.setCaretPosition(0);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setPreferredSize(new Dimension(350, 150));
int res = JOptionPane.showConfirmDialog(null,scrollPane,"Query", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
System.out.println( "showInputDialog: " + res );
if(res==0)
queryTextArea.setText(textArea.getText());

Using this I'm unable to resize the document-modal

SECOND:

String str = queryTextArea.getText();
final JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Sans-Serif", Font.PLAIN, 12));
textArea.setText(str);
textArea.setCaretPosition(0);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setPreferredSize(new Dimension(350, 150));
JOptionPane pane = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE,JOptionPane.PLAIN_MESSAGE);
JDialog dialog = pane.createDialog(null, "Query");
dialog.setResizable(true);
dialog.setVisible(true);

Using This I'm unable to get which button is pressed (OK/Cancel/Closed using X)

Please Help..

Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Darryl,
another time-waster added to my ignore list.
 
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!