Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #2699

Re: JlayeredPane in netbeans

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: JlayeredPane in netbeans
Date 2011-04-01 15:03 -0700
Organization A noiseless patient Spider
Message-ID <in5i3l$892$1@dont-email.me> (permalink)
References <ec706a53-b845-49dc-a809-b1246dee81ea@o21g2000prh.googlegroups.com>

Show all headers | View raw


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");
}

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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