import java.awt.*; public class FrameTest { public static void main(String[] args) { var f = new Frame("测试窗口"); f.setBounds(30,30,250,300); f.setVisible(true); } } result:…
import javax.swing.*; import java.awt.*; import java.util.Random; public class SimpleDraw { private final String RECT_SHAPE = "rect"; private final String OVAL_SHAPE = "oval"; private Frame f = new Frame("Test"); private JBut…
import java.awt.*; import java.awt.event.*; public class SimpleMenu { private Frame f = new Frame("test"); private MenuBar mb = new MenuBar(); Menu file = new Menu("file"); Menu edit = new Menu("edit"); PopupMenu pop = new Po…
import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class EventQs { private Frame f = new Frame("event test"); private Button ok = new Button("confired"); ); public v…
import java.awt.*; public class DialogTest { Frame f = new Frame("test"); Dialog d1 = new Dialog(f, "model dialog", true); Dialog d2 = new Dialog(f, "non-model dialog", false); Button b1 = new Button("open model dialog&q…
import javax.swing.*; import java.awt.*; public class CommonComponent { Frame f = new Frame("test"); Button ok = new Button("confirmed"); CheckboxGroup cbg = new CheckboxGroup(); Checkbox male = new Checkbox("man", cbg, true)…