1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
package gui;
import javax.swing.JPanel;
import java.awt.Frame;
import javax.swing.SpinnerNumberModel;
import javax.swing.JSpinner;
import javax.swing.JDialog;
import javax.swing.JButton;
import java.awt.Rectangle;
import javax.swing.JLabel;
public class EditorFrameNew extends JDialog {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton btnOk = null;
private JButton btnCancel = null;
private JLabel lblRow = null;
private JLabel lblColumns = null;
private JSpinner spRows = null;
private JSpinner spColumns = null;
/**
* @param owner
*/
public EditorFrameNew(Frame owner) {
super(owner);
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(250, 141);
this.setModal(true);
setTitle("New map");
this.setVisible(true);
this.setContentPane(getJContentPane());
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
lblColumns = new JLabel();
lblColumns.setBounds(new Rectangle(15, 38, 123, 19));
lblColumns.setText("Number of columns:");
lblRow = new JLabel();
lblRow.setBounds(new Rectangle(15, 11, 122, 19));
lblRow.setText("Number of rows:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getBtnOk(), null);
jContentPane.add(getBtnCancel(), null);
jContentPane.add(lblRow, null);
jContentPane.add(lblColumns, null);
jContentPane.add(getSpRows(), null);
jContentPane.add(getSpColumns(), null);
}
return jContentPane;
}
/**
* This method initializes btnOk
*
* @return javax.swing.JButton
*/
private JButton getBtnOk() {
if (btnOk == null) {
btnOk = new JButton();
btnOk.setBounds(new Rectangle(26, 67, 81, 29));
btnOk.setText("Create");
btnOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return btnOk;
}
/**
* This method initializes btnCancel
*
* @return javax.swing.JButton
*/
private JButton getBtnCancel() {
if (btnCancel == null) {
btnCancel = new JButton();
btnCancel.setBounds(new Rectangle(133, 67, 81, 29));
btnCancel.setText("Cancel");
btnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return btnCancel;
}
/**
* This method initializes spRows
*
* @return javax.swing.JTextField
*/
private JSpinner getSpRows() {
if (spRows == null) {
spRows=new JSpinner(new SpinnerNumberModel(0, 0, 10,1));
spRows.setEditor(new JSpinner.NumberEditor(spRows, "0"));
spRows.setBounds(new Rectangle(167, 11, 59, 19));
}
return spRows;
}
/**
* This method initializes spColumns
*
* @return javax.swing.JTextField
*/
private JSpinner getSpColumns() {
if (spColumns == null) {
spColumns=new JSpinner(new SpinnerNumberModel(0, 0, 10,1));
spColumns.setEditor(new JSpinner.NumberEditor(spColumns, "0"));
spColumns.setBounds(new Rectangle(167, 38, 59, 19));
}
return spColumns;
}
} // @jve:decl-index=0:visual-constraint="10,10" |
Partager