jtabbedpane:JTabbedPane 刷新 Jpanel面板的遍历

涉及到跨面板 Control控件, 通过写思路方法,外部也可以,

package com.lion.tea.ui.model;

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 t 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*/
count;

private JButton b22;

/** A tabbed pane with three content tabs. */
t {
super("Flip Tabs");

jtp = JTabbedPane;
add( jtp );

page1 = JPanel;
b1 = JButton("Button 1");
b1.addActionListener(this);
page1.add( b1 );

jtp.add( page1, "page1" );

page2 = JPanel;
b22 = JButton("Button 222");
page2.add(b22);
jtp.add( page2, "page2" );

page3 = JPanel;
jtp.add( page3, "page3" );

add(jtp);

pack;
Size( getPreferredSize );

count = 0;
}

/** _disibledevent=>
.out.prln(((JButton)o).getText);
( ob1 ) {
(b2null) {
b2 = JButton("Button 2");
b22.Text("chensss");
b2.addActionListener(this);
page2.add( b2 );
jtp.SelectedComponent( b2.getParent );
for ( i =0;i <page2.getComponentCount;i)

{
JButton a =(JButton)page2.getComponent(i);

.out.prln("sss"+a.getText);//

}

}
} { // must be b2
JLabel l1 = JLabel("Heyoo! .." + count);
page3.add( l1 );
jtp.SelectedComponent( l1.getParent );
}
validate;
}

/** Gimme' it. Now! */
public void (String args) {
t f = t;

f.Visible(true);
}
}
Tags:  jpanel刷新 jtabbedpane选项卡 javajtabbedpane jtabbedpane

延伸阅读

最新评论

发表评论