awt_wttest.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 995 行 · 第 1/3 页
JAVA
995 行
redpanel.add(bs);
redpanel.add(be);
redpanel.add(bw);
// redpanel.add( bc);
redpanel.add(sbar);
redpanel.layout();
window2.add(redpanel);
return window2;
}
public static JNWindow getFlowLayoutWindow3() {
JNWindow window2 = null;
window2 = new JNWindow();
window2.setSize(new Dimension(400, 300));
window2.setBackground(new Color(207, 207, 207));
window2.setLocation(10, 100);
window2.setVisible(true);
JNPanel redpanel = new JNPanel();
redpanel.setLocation(0, 20);
redpanel.setBackground(window2.getBackground());
redpanel.setSize(window2.getSize());
redpanel.setLayout(new JNFlowLayout());
redpanel.setBackground(Color.cyan);
JNButton bs = new JNButton("and ag");
JNButton be = new JNButton("E for Elephant");
JNButton bw = new JNButton("We aa as st");
redpanel.add(bs);
redpanel.add(be);
redpanel.add(bw);
redpanel.layout();
window2.add(redpanel);
return window2;
}
public static JNWindow getMenu() {
JNWindow window2 = new JNWindow(true);
window2.setSize(new Dimension(500, 500));
window2.setBackground(Color.blue);
// window2.setLocation(330,10);
window2.setLocation(50, 100);
window2.setVisible(true);
JNPanel redpanel = new JNPanel();
redpanel.setLocation(100, 0);
redpanel.setSize(300, 300);
redpanel.setBackground(Color.red);
// redpanel.pname = "red ddpanel";
final JNButton tbtn = new JNButton("0,0");
tbtn.setLocation(0, 0);
redpanel.add(tbtn);
final JNButton t2btn = new JNButton("30,300 ");
t2btn.setLocation(0, 300);
redpanel.add(t2btn);
final JNMenu amenu = new JNMenu("");
amenu.add("abc");
amenu.add("def");
amenu.add("ghijklmnop aldkf alkdki");
amenu.add("jkl");
amenu.setLocation(100, 100);
amenu.setSize(amenu.getPreferredSize());
redpanel.add(amenu);
//
window2.add(redpanel);
return window2;
}
public static JNWindow getMenu2() {
JNFrame frame = new JNFrame();
frame.setSize(500, 500);
// frame.setBackground( Color.blue );
frame.setLocation(50, 100);
frame.setVisible(true);
JNMenuBar menubar = new JNMenuBar();
JNMenu amenu = new JNMenu("File");
amenu.add("Open");
amenu.add("Close");
amenu.add("ghijklmnop aldkf alkdki");
amenu.addSeparator();
amenu.add("Exit");
amenu.setSize(amenu.getPreferredSize());
JNMenu amenu2 = new JNMenu("Window");
amenu2.add("Search");
amenu2.add("Replace");
amenu2.setSize(amenu2.getPreferredSize());
JNMenu amenu3 = new JNMenu("WorkSpace");
amenu3.setMenuStyle(JNDefaultLookAndFeel.JAVA_STYLE_MENU);
amenu3.add("Save WorkSpace");
amenu3.add("Save File");
amenu3.add("Open WorkSpace");
amenu3.add("Open a File");
amenu3.setSize(amenu3.getPreferredSize());
JNMenu amenuh = new JNMenu("Help");
amenuh.add("Open");
amenuh.add("Close");
amenuh.add("ghijklmnop aldkf alkdki");
amenuh.add("Exit");
amenuh.setSize(amenuh.getPreferredSize());
menubar.add(amenu);
menubar.add(amenu2);
menubar.add(amenu3);
menubar.add(amenuh);
frame.setMenuBar(menubar);
//combo
JNPanel redpanel = new JNPanel();
redpanel.setLocation(100, 0);
redpanel.setSize(400, 300);
redpanel.setBackground(Color.red);
JNComboBox combo = new JNComboBox();
combo.setSize(200, 100);
combo.setLocation(180, 150);
for (int i = 0; i < 20; i++) {
combo.add("ABCD" + i);
}
redpanel.add(combo);
frame.add(redpanel);
//
return frame;
}
public static JNWindow getPanelLayoutCheck() {
JNWindow frame = new JNWindow();
frame.setSize(500, 500);
frame.setLocation(50, 50);
frame.setVisible(true);
JNPanel bluepanel = new JNPanel();
bluepanel.setLocation(10, 10);
bluepanel.setSize(480, 480);
bluepanel.setBackground(Color.blue);
// bluepanel.setLayout(new JNFlowLayout());
bluepanel.setLayout(new JNBorderLayout());
JNPanel redpanel = new JNPanel();
redpanel.setBackground(Color.red);
redpanel.setLayout(new JNFlowLayout());
redpanel.add(new JNButton("redButton"));
redpanel.add(new JNButton("redButton2"));
redpanel.add(new JNButton("redB3"));
bluepanel.add(redpanel, JNBorderLayout.NORTH);
JNPanel greenpanel = new JNPanel();
greenpanel.setBackground(Color.green);
greenpanel.setLayout(new JNFlowLayout());
greenpanel.add(new JNButton("abced"));
greenpanel.add(new JNButton("asddsfe"));
greenpanel.add(new JNButton("@#@#$@$e"));
greenpanel.layout();
bluepanel.add(greenpanel, JNBorderLayout.CENTER);
frame.add(bluepanel);
return frame;
}
public static JNWindow getTabbedPane() {
// JNFrame frame = new JNFrame();
JNWindow frame = new JNWindow();
frame.setSize(500, 500);
frame.setLocation(50, 50);
frame.setVisible(true);
JNTabbedPane tabpane = new JNTabbedPane();
tabpane.setLocation(50, 100);
tabpane.setSize(300, 300);
JNPanel redpanel = new JNPanel();
redpanel.setBackground(Color.red);
JNButton b = new JNButton("RED");//This is a button");
b.setLocation(10, 10);
redpanel.add(b);
JNPanel bluepanel = new JNPanel();
bluepanel.setBackground(Color.blue);
JNButton b2 = new JNButton("BLUE");//Click me button");
b2.setLocation(10, 60);
bluepanel.add(b2);
JNPanel greenpanel = new JNPanel();
greenpanel.setBackground(Color.green);
JNLabel lab = new JNLabel("GREEN");//This is a Label");
lab.setLocation(50, 10);
greenpanel.add(lab);
JNPanel yellowpanel = new JNPanel();
yellowpanel.setBackground(Color.yellow);
// JNRadioButton rad = new JNRadioButton("Listen to Radio");
JNButton rad = new JNButton("Yellow");//Listen to Radio");
rad.setLocation(50, 160);
yellowpanel.add(rad);
redpanel.setLayout(null);
bluepanel.setLayout(null);
greenpanel.setLayout(null);
yellowpanel.setLayout(null);
tabpane.add(redpanel, "RED");
tabpane.add(bluepanel, "Blue");
tabpane.add(greenpanel, "GREEN");
tabpane.add(yellowpanel, "YELLOW");
// tabpane.setTabPlacement(JNDefaultLookAndFeel.BOTTOM);
tabpane.setTabPlacement(JNDefaultLookAndFeel.LEFT);
// tabpane.setTabPlacement(JNDefaultLookAndFeel.RIGHT);
frame.add(tabpane);
tabpane.setSelected(1);
return frame;
}
public static JNWindow getWidgetsWindow() {
JNWindow window2 = null;
window2 = new JNWindow(true);
window2.setSize(new Dimension(450, 500));
window2.setBackground(new Color(207, 207, 207));
// window2.setLocation(330,10);
window2.setLocation(0, 50);
window2.setVisible(true);
JNPanel redpanel = new JNPanel();
redpanel.setLocation(0, 30);
redpanel.setBackground(window2.getBackground());
/*
* addLabelsToPanel( redpanel ); addCheckBoxsToPanel( redpanel );
*/
JNButton b1 = new JNButton("Button");
b1.setLocation(300, 300);
b1.setSize(200, 30);
// redpanel.add( b1 );
//
final JNButton tbtn = new JNButton("0,0");
tbtn.setLocation(0, 0);
redpanel.add(tbtn);
final JNButton t2btn = new JNButton("0,300");
t2btn.setLocation(0, 300);
redpanel.add(t2btn);
final JNButton t3btn = new JNButton("100,300");
t3btn.setLocation(100, 200);
t3btn.setSize(100, 100);
redpanel.add(t3btn);
//
window2.add(redpanel);
return window2;
}
public static JNWindow getWidgetsWindow2() {
JNWindow window2 = new JNWindow(true);
window2.setSize(new Dimension(500, 500));
// window2.setBackground( Color.blue );
// window2.setLocation(330,10);
window2.setLocation(50, 100);
window2.setVisible(true);
JNPanel redpanel = new JNPanel();
redpanel.setLocation(20, 10);
redpanel.setSize(400, 450);
redpanel.setBackground(Color.red);
// redpanel.pname = "red ddpanel";
final JNButton tbtn = new JNButton("0,0");
tbtn.setLocation(0, 0);
// redpanel.add(tbtn);
final JNButton t2btn = new JNButton("30,300 ");
t2btn.setLocation(0, 300);
// redpanel.add(t2btn);
/*
* final JNButton t3btn = new JNButton("100,300");
* t3btn.setLocation(100,200); t3btn.setSize(100,100);
* redpanel.add(t3btn);
*/
JNScrollBar sbar = new JNScrollBar(JNScrollBar.HORIZONTAL);
sbar.setLocation(50, 10);
sbar.setSize(150, 30);
sbar.setPreferredSize(sbar.getSize());
redpanel.add(sbar);
sbar.setMinMax(0, 90);
sbar.setUnitIncrement(5);
sbar.addAdjustmentListener(new JNAdjustmentListener() {
public void adjustmentValueChanged(JNAdjustmentEvent e) {
System.out.println(e.getValue());
}
});
redpanel.add(sbar);
// List box.
final JNList alist = new JNList();
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?