> Try..
> JPanel parent =
> theButton.getParent() // inherited from Component
>> Try..
>> JPanel parent =
>> theButton.getParent() // inherited from Component
>
> i need to learn English... ;-)
I'd say your English is far superior
to my ..Italian?
> I don't want simply the parent but refresh another component added in -- i
> want recreate the jpanel of another page of a JTabbedPane --
[quoted text clipped - 3 lines]
> i'm in page1, clicking the button i want recreate page2 with the same or
> another jpanel...
OK.. I'm still a little confused, I might
suggest you give us a code example of
exactly what your doing, ..but I do not
think that will explain what you are *trying*
to do, so we'll skip that for the moment.
So, again something you wrote earlier..
"First has a button and have to set a
Jlabel in Second, the going to Second i
want to see the new value of my Label..."
Does that mean..
1) Click button in page1 (that is a JPanel, right? )
2) Button click makes a new JLabel in page2 (?)
3) Set the text of the JLabel in page2
and flip to that tab of the JTabbedPane.
I am not sure about 2).. before button
click, does the JLabel on page2 exist?
Is the JLabel on page2 before the button
click, or do you want to add it after the
button is clicked?
Actually, when I look back through this
thread, the more I think it might be best
to see a short example code.
Your code might help us understand what you
have done, and what you are *trying* to do.
What do you say?

Signature
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Daniele80 - 07 Sep 2004 22:57 GMT
:-) i started with a problem and now i want to do something else:
I just want to know how can i flip to anothe page of JTabbenPane clicking a
button
on Frame class i set
jTabbedPane.add(new Page1(), " 1 ");
jTabbedPane.add(new Page2(), " 2 ");
on Page1
i click the button -> i want to refer to Page2 of JTabbedPane and set that
component as new Page3() ...
Andrew Thompson - 08 Sep 2004 01:44 GMT
> I just want to know how can i flip to anothe page of JTabbenPane clicking a
> button
OK. So far so good...
> i click the button -> i want to refer to Page2 of JTabbedPane and set that
> component as new Page3() ...
now ..this is where you lose me.
But, because I am feeling particularly magnanimous
at the moment, I thought I'd throw together my
*own* exmple, that shows my current understanding
(or not) of your problem requirement..
<sscce>
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/** A simple example that demontrates my (almost
complete) lack of understanding of the question. ;-) */
public class FlipTab extends JFrame
implements ActionListener {
/* The tabbed pane at the heart of it. */
JTabbedPane jtp;
/** Content panel of the tabbed pane */
JPanel page1, page2, page3;
/** Button to control UI */
JButton b1, b2;
/** Counter for the labels*/
int count;
/** A tabbed pane with three content tabs. */
FlipTab() {
super("Flip Tabs");
jtp = new JTabbedPane();
add( jtp );
page1 = new JPanel();
b1 = new JButton("Button 1");
b1.addActionListener(this);
page1.add( b1 );
jtp.add( page1, "page1" );
page2 = new JPanel();
jtp.add( page2, "page2" );
page3 = new JPanel();
jtp.add( page3, "page3" );
add(jtp);
pack();
setSize( getPreferredSize() );
count = 0;
}
/** On button one, make and flip to button 2.
On button two, add another label to tabbed pane 3. */
public void actionPerformed(ActionEvent ae) {
Object o = ae.getSource();
if ( o==b1 ) {
if (b2==null) {
b2 = new JButton("Button 2");
b2.addActionListener(this);
page2.add( b2 );
jtp.setSelectedComponent( b2.getParent() );
}
} else { // must be b2
JLabel l1 = new JLabel("Heyoo! .." + ++count);
page3.add( l1 );
jtp.setSelectedComponent( l1.getParent() );
}
validate();
}
/** Gimme' it. Now! */
public static void main(String [] args) {
FlipTab f = new FlipTab();
f.setVisible(true);
}
}
</sscce>
?

Signature
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology