MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / Test_Dialog

Method Test_Dialog

src/demoJS/Test_Dialog.java:112–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110 private JButton colorButton;
111
112 public Test_Dialog() {
113 super();
114 this.setTitle("testing dialogs");
115
116 JPanel m = new JPanel(new GridLayout());
117 status = new JLabel("testing");
118 m.add(status, null);
119 add(m, BorderLayout.SOUTH);
120
121 JPanel p = new JPanel();
122 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
123 add(p, BorderLayout.CENTER);
124 this.setLocation(300, 300);
125 JButton b;
126
127 b = new JButton("ConfirmDialog");
128 final JPanel content = new JPanel();
129 content.setLayout(new BorderLayout());
130 content.add(new JLabel("this is the option panel"), BorderLayout.CENTER);
131 b.addActionListener(new ActionListener() {
132 @Override
133 public void actionPerformed(ActionEvent e) {
134 Test_Dialog.this.onDialogReturn(JOptionPane.showConfirmDialog(Test_Dialog.this,
135 "<html>The frame is now " + (isResizable() ? "<b>NOT</b> " : "") + "resizable.</html>",
136 "Testing JOptionPane", JOptionPane.OK_CANCEL_OPTION));
137 setResizable(!isResizable());
138 }
139
140 });
141 p.add(b);
142
143 b = new JButton("MessageDialog");
144 final JPanel message = new JPanel();
145 message.setLayout(new BorderLayout());
146 message.add(new JLabel("this is the message panel"), BorderLayout.CENTER);
147 b.addActionListener(new ActionListener() {
148
149 @Override
150 public void actionPerformed(ActionEvent e) {
151 JOptionPane.showMessageDialog(Test_Dialog.this, message);
152 }
153
154 });
155 p.add(b);
156
157 b = new JButton("InputDialog");
158 final JPanel input = new JPanel();
159 input.setLayout(new BorderLayout());
160 input.add(new JLabel("this is the input panel"), BorderLayout.CENTER);
161 b.addActionListener(new ActionListener() {
162
163 @Override
164 public void actionPerformed(ActionEvent e) {
165 Test_Dialog.this.onDialogReturn(JOptionPane.showInputDialog(Test_Dialog.this, input));
166 }
167
168 });
169 p.add(b);

Callers

nothing calls this directly

Calls 5

setTitleMethod · 0.65
addActionListenerMethod · 0.65
setVisibleMethod · 0.65
addMethod · 0.45
setLocationMethod · 0.45

Tested by

no test coverage detected