Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #2721
| From | mukesh tiwari <mukeshtiwari.iiitm@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JlayeredPane in netbeans |
| Date | 2011-04-01 23:26 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <cf1e3a22-c64d-4bba-bc41-585ca16683ff@b13g2000prf.googlegroups.com> (permalink) |
| References | <ec706a53-b845-49dc-a809-b1246dee81ea@o21g2000prh.googlegroups.com> <in5i3l$892$1@dont-email.me> |
On Apr 2, 3:03 am, markspace <-@.> wrote:
> On 4/1/2011 12:23 PM, mukesh tiwari wrote:
>
>
>
>
>
> > Hello all, I am trying to put two components Jeditorpane and Jtextarea
> > in Jlayeredpane. I am using Netbeans. I added jeditorpane and
> > jtextarea in jlayeredpane and two buttons. When i click on button1
> > then it should show message "Hello world doing nice".
>
> > private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
> > {
> > // TODO add your handling code here:
> > jTextArea1.setText("");
> > jTextArea1.setOpaque(true);
> > jLayeredPane1.moveToFront(jEditorPane1);
> > jEditorPane1.setText("Hello world doing nice");
> > }
> > and when click on button2 then it should show message "Hello world not
> > doing good".
>
> > private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
> > {
> > // TODO add your handling code here:
> > jEditorPane1.setText("");
> > jEditorPane1.setOpaque(true);
> > jLayeredPane1.moveToFront(jTextArea1);
> > jTextArea1.setText("Hello world not doing good");
> > }
>
> I simplified these methods to remove unnecessary calls. The result is
> better and the text now displays. However the formatting is still a bit
> odd, it looks like some of the text is offset slightly from the origin.
> I'm not sure why that is.
>
> Here are the improved event handlers.
>
> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
> // TODO add your handling code here:
> // jTextArea1.setText("");
> // jTextArea1.setOpaque(true);
> // jLayeredPane1.moveToFront(jEditorPane1);
> jEditorPane1.setText("Hello world doing nice");
>
> }
>
> private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
> // TODO add your handling code here:
> // jEditorPane1.setText("");
> // jEditorPane1.setOpaque(true);
> // jLayeredPane1.moveToFront(jTextArea1);
> jTextArea1.setText("Hello world not doing good");
>
>
>
> }
Hi markspace
Thank you for your reply but this is not fulfilling the purpose
because texts are deformed in second case. I don't know if i
understand the JlayeredPane fully but what in my mind is , i added
two components [ jeditorpane and jtextarea ] in jLayeredpane in same
Default_Layer and use the function moveTofront and moveToback to move
these components in same layer.When jeditorpane will be in front
position then it will hide all the contents of jtextarea and vice-
versa. Its like dynamically changing the components position in layer
but i don't think this is happening. Thanks again for your valuable
insights.
Regards
Mukesh Tiwari
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
JlayeredPane in netbeans mukesh tiwari <mukeshtiwari.iiitm@gmail.com> - 2011-04-01 12:23 -0700
Re: JlayeredPane in netbeans markspace <-@.> - 2011-04-01 15:03 -0700
Re: JlayeredPane in netbeans mukesh tiwari <mukeshtiwari.iiitm@gmail.com> - 2011-04-01 23:26 -0700
Re: JlayeredPane in netbeans "John B. Matthews" <nospam@nospam.invalid> - 2011-04-02 10:41 -0400
csiph-web