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
| Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
int screenHeight = d.height;
int screenWidth = d.width;
//int screenHeight = 750;
//int screenWidth = 1000;
setSize(screenWidth / 2, screenHeight / 2);
setLocation(screenWidth / 4 + 30, screenHeight / 4 + 50);
Container contentPane = getContentPane();
GridBagLayout gbl = new GridBagLayout();
contentPane.setLayout(gbl);
GridBagConstraints gbc = new GridBagConstraints();
//gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.insets.top = 15;
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.NORTH;
//gbc.fill = GridBagConstraints.NONE;
//gbc.anchor = GridBagConstraints.NORTHEAST;
gbc.weightx = 0.1;
add(new JLabel("Project name: "), gbc, 0, 0, 1, 1);
gbc.weightx = 0.9;
add(projectName, gbc, 1, 0, 1, 1);
gbc.weightx = 0.1;
add(new JLabel("Project location: "), gbc, 0, 1, 1, 1);
gbc.weightx = 0.9;
add(projectLocation, gbc, 1, 1, 1, 1);
gbc.weightx = 0.1;
add(new JLabel("Create an empty Project? "), gbc, 0, 2, 1, 1);
gbc.weightx = 0.9;
add(emptyOpt, gbc, 1, 2, 1, 1);
gbc.weightx = 0.1;
add(new JLabel("Project input file: "), gbc, 0, 3, 1, 1);
gbc.weightx = 0.9;
add(inputFileBrowse, gbc, 1, 3, 1, 1);
add(inputFileName, gbc, 1, 4, 1, 1);
//gbc.weightx = 100;
//gbc.fill = GridBagConstraints.HORIZONTAL;
//gbc.anchor = GridBagConstraints.NORTH;
JComboBox encoding = new JComboBox();
encoding.setEditable(false);
encoding.addItem("UTF-8");
encoding.addItem("ISO8859-1");
encoding.setSelectedIndex(0);// Default is "not empty project".
encoding.setSelectedItem("UTF-8");
gbc.weightx = 0.1;
add(new JLabel("Encoding: "), gbc, 0, 5, 1, 1);
gbc.weightx = 0.9;
add(encoding, gbc, 1, 5, 1, 1);
JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 25, 25));
okBT = new DHJButton(this, "OK");
okBT.setPreferredSize(new Dimension(75, 25));
bottomPanel.add(okBT);
JButton jb = new DHJButton(this, "Cancel");
jb.setPreferredSize(new Dimension(75, 25));
bottomPanel.add(jb);
gbc.weighty = 100;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.SOUTH;
add(bottomPanel, gbc, 0, 5, 2, 1);
inputFileBrowse.setEnabled(!emptyProject); |
Partager