protected void initContent() { this.setTitle("管理座位"); this.setBackground(Color.WHITE); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); // 得到屏幕的大小 setBounds((screen.width - 300) / 2, (screen.height - 200) / 2, 300, 200); setLayout(new BorderLayout()); JPanel footerJPanel = new JPanel(); add(footerJPanel, BorderLayout.SOUTH); Integer[] statusList = new Integer[] {0, 1, -1}; status = new JComboBox<Integer>(statusList); status.setSize(60, 30); add(status, BorderLayout.NORTH); btnSave = new JButton("保存"); btnSave.addActionListener(this); footerJPanel.add(btnSave); btnCancel = new JButton("取消"); btnCancel.addActionListener(this); footerJPanel.add(btnCancel); // ImageJPanel imageJP = new ImageJPanel(new ImageIcon( // "resource/image/pencil.jpg").getImage()); // imageJP.setBounds(80, 80, 100, 100); // imageJP.setLayout(null); // this.add(imageJP); }
private void initJComboBox(JComboBox jcb) { jcb.setSize(120, 20); jcb.setOpaque(false); jcb.setFocusable(false); jcb.setRenderer(new StarComboBoxRender()); jcb.setUI((ComboBoxUI) StarComboBoxUI.createUI(jcb)); jcb.setBorder(new RoundBorder(Color.red)); add(jcb); }
public EmployeeCUDialog(JFrame owner, String title) { super(owner); this.setTitle(title); this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.setLocation(500, 250); this.setSize(200, 300); this.setLayout(null); this.setModal(true); lblName = new JLabel("Name:"); this.add(lblName); lblName.setLocation(20, 10); lblName.setSize(100, 25); txfName = new JTextField(); this.add(txfName); txfName.setLocation(20, 35); txfName.setSize(150, 25); lblWage = new JLabel("Wage:"); this.add(lblWage); lblWage.setLocation(20, 70); lblWage.setSize(100, 25); txfWage = new JTextField(); this.add(txfWage); txfWage.setLocation(20, 95); txfWage.setSize(150, 25); lblCompany = new JLabel("Company:"); this.add(lblCompany); lblCompany.setLocation(20, 130); lblCompany.setSize(100, 25); cbxCompanies = new JComboBox<Company>(); this.add(cbxCompanies); cbxCompanies.setLocation(20, 155); cbxCompanies.setSize(150, 25); cbxCompanies.setMaximumRowCount(4); btnOk = new JButton("Ok"); this.add(btnOk); btnOk.setLocation(15, 225); btnOk.setSize(70, 25); btnOk.addActionListener(controller); btnCancel = new JButton("Cancel"); this.add(btnCancel); btnCancel.setLocation(95, 225); btnCancel.setSize(80, 25); btnCancel.addActionListener(controller); // initialise this view controller.fillCbxCompanies(); }
private void setYearComboBox(Calendar c) { int y = c.get(Calendar.YEAR); years = new Integer[7]; for (int i = y - 3, j = 0; i <= y + 3; i++, j++) { years[j] = new Integer(i); } if (yearBox == null) { yearBox = new JComboBox(); yearBox.addActionListener(this); yearBox.setFont(DatePicker.plain); yearBox.setSize(yearBox.getWidth(), height); yearBox.setPreferredSize(new Dimension(yearBox.getWidth(), height)); } yearBox.setModel(new DefaultComboBoxModel(years)); yearBox.setSelectedItem(years[3]); }
/** Creates new form gui */ public gui() { super(new BorderLayout()); initComponents(); // Load user list and images images = new ImageIcon[userStrings.length]; Integer[] intArray = new Integer[userStrings.length]; for (int i = 0; i < userStrings.length; i++) { intArray[i] = new Integer(i); images[i] = createImageIcon("images/" + userStrings[i] + ".png"); if (images[i] != null) { images[i].setDescription(userStrings[i]); } } users = new JComboBox(intArray); Color bg = (Color) UIManager.get("ComboBox.background"); Color fg = (Color) UIManager.get("ComboBox.foreground"); UIManager.put("ComboBox.selectionBackground", bg); UIManager.put("ComboBox.selectionForeground", fg); users.setUI(new MetalComboBoxUI()); // ComboBoxRenderer renderer = new ComboBoxRenderer(); ComboBoxRenderer renderer = new ComboBoxRenderer(userStrings, images); renderer.setPreferredSize(new Dimension(650, 150)); users.setRenderer(renderer); users.setSize(renderer.getPreferredSize()); users.setMaximumRowCount(4); users.setBounds(150, 250, 650, 200); add(users); // setBorder(BorderFactory.createEmptyBorder(20,20,20,20)); // Set the user satisfaction labels jSlider1.setPaintTicks(true); Hashtable labelTable = new Hashtable(); for (int i = 0; i < labels.length; i++) { labelTable.put(new Integer(i), new JLabel(labels[i])); } jSlider1.setLabelTable(labelTable); jSlider1.setPaintLabels(true); socket = new generalSocket(machine, 1099); statusThread thread = new statusThread(socket, jLabel4); Thread theThread = new Thread(thread); theThread.start(); }
private void setMonthComboBox(Calendar c) { if (months == null) { months = new String[12]; for (int i = 0; i < 12; i++) { String m = parent.getString("month." + i, ""); months[i] = m; } } if (monthBox == null) { monthBox = new JComboBox(); monthBox.addActionListener(this); monthBox.setFont(DatePicker.plain); monthBox.setSize(monthBox.getWidth(), height); monthBox.setPreferredSize(new Dimension(monthBox.getWidth(), height)); } monthBox.setModel(new DefaultComboBoxModel(months)); monthBox.setSelectedIndex(c.get(Calendar.MONTH)); }
/** * adds comboBox to fxz composer toolbar * * @param toolbar Toolbar to add comboBox at * @param comboBox comboBox to add * @param index the position in the container's list at which to insert the component; <code>-1 * </code> means insert at the end component * @param isEditable is comboBox editable */ public static void addCombo(JToolBar toolbar, JComboBox comboBox, int index, boolean isEditable) { GridBagConstraints constrains = new GridBagConstraints(); constrains.anchor = GridBagConstraints.WEST; constrains.insets = new Insets(0, 3, 0, 2); // @inherited fix of issue #69642. Focus shouldn't stay in toolbar comboBox.setFocusable(false); Dimension size = comboBox.getPreferredSize(); comboBox.setPreferredSize(size); comboBox.setSize(size); comboBox.setMinimumSize(size); comboBox.setMaximumSize(size); comboBox.setEditable(isEditable); toolbar.add(comboBox, constrains, index); }
public FocusURNSelectBox() { super(BoxLayout.LINE_AXIS); setMaximumSize(new Dimension(width, 40)); setSize(width, 40); ArrayList<JComponent> boxList = new ArrayList<JComponent>() { @Override public boolean add(JComponent c) { // ボックスにする Box box = Box.createHorizontalBox(); box.setMaximumSize(c.getSize()); box.setSize(c.getSize()); box.add(c); return super.add(box); } }; final JLabel nameLabel = new JLabel("FocusEntityURN"); nameLabel.setSize(width / 4, 40); nameLabel.setMaximumSize(new Dimension(width * 2 / 8, 24)); boxList.add(nameLabel); Vector<String> items = new Vector<String>(); strToURN = new HashMap<String, StandardEntityURN>(); items.add("Null"); for (StandardEntityURN urn : Viewer.INDEX_CLASS) { strToURN.put(urn.name(), urn); items.add(urn.name()); } Collections.sort(items); urnComboBox = new JComboBox(items); urnComboBox.setSize(width * 3 / 4, 24); urnComboBox.setMaximumRowCount(Viewer.INDEX_CLASS.length); urnComboBox.addItemListener(this); boxList.add(urnComboBox); urnComboBox.setSelectedItem("Null"); for (JComponent c : boxList) { add(c); } }
public FocusSelectBox() { super(BoxLayout.LINE_AXIS); setMaximumSize(new Dimension(width, 40)); setSize(width, 40); ArrayList<JComponent> boxList = new ArrayList<JComponent>() { @Override public boolean add(JComponent c) { // ボックスにする Box box = Box.createHorizontalBox(); box.setMaximumSize(c.getSize()); box.setSize(c.getSize()); box.add(c); return super.add(box); } }; final JLabel nameLabel = new JLabel("FocusEntity"); nameLabel.setSize(width / 4, 40); nameLabel.setMaximumSize(new Dimension(width * 2 / 8, 24)); boxList.add(nameLabel); entitiesComboBox = new JComboBox(); try { resetEntitiesComboBox(null); } catch (NullPointerException e) { } entitiesComboBox.setSize(width * 3 / 4, 24); entitiesComboBox.addItemListener(this); boxList.add(entitiesComboBox); for (JComponent c : boxList) { add(c); } }
private void initializeComponent() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); getRootPane().setLayout(new BorderLayout()); getRootPane().add(panel, BorderLayout.CENTER); JButton createButton = new JButton("New..."); createButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { create(); } }); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(5, 5, 5, 5); c.anchor = GridBagConstraints.WEST; panel.add(createButton, c); contexts = new JComboBox(new DefaultComboBoxModel()); contexts.setPreferredSize(new Dimension(80, 24)); contexts.setSize(new Dimension(80, 24)); c = new GridBagConstraints(); c.weightx = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(5, 5, 5, 5); panel.add(contexts, c); contexts.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { refresh(); } }); JButton refreshButton = new JButton("Refresh"); refreshButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { refresh(); } }); c = new GridBagConstraints(); c.insets = new Insets(5, 5, 5, 5); panel.add(refreshButton, c); itemTable = new JTable(1, 6); itemTable.setRowHeight(35); itemTable.setShowHorizontalLines(false); itemTable.setShowVerticalLines(false); itemTable.addKeyListener( new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) { ctrl = false; } public void keyPressed(KeyEvent e) { if (e.isControlDown()) { ctrl = true; } } }); itemTable .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { int index = e.getFirstIndex(); if (index >= 0 && index < items.size()) { ChecklistItem item = items.get(index); if (item.getStatus() == Status.Created) { String actorId = getActorId(); try { checklistManager.claimTask(actorId, item.getTaskId()); if (ctrl) { checklistManager.abortTask(actorId, item.getTaskId()); } else { checklistManager.completeTask(actorId, item.getTaskId()); } } catch (Throwable t) { // Do nothing } refresh(); } else if (item.getStatus() == Status.Reserved) { String actorId = getActorId(); if (item.getActors().equals(actorId)) { try { if (ctrl) { checklistManager.abortTask(actorId, item.getTaskId()); } else { checklistManager.completeTask(actorId, item.getTaskId()); } } catch (Throwable t) { // Do nothing } refresh(); } } else if (item.getStatus() == Status.Optional) { try { checklistManager.selectOptionalTask( item.getName(), Long.valueOf((String) contexts.getSelectedItem())); } catch (Throwable t) { // Do nothing t.printStackTrace(); } refresh(); } } } }); // TODO: // default width of columns // icons for state // not-editable // no selection // (scratch for aborted?) // replace refresh, create, etc. by icon c = new GridBagConstraints(); c.gridy = 1; c.weightx = 1; c.weighty = 1; c.gridwidth = 3; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(5, 5, 5, 5); panel.add(itemTable, c); JLabel nameLabel = new JLabel("Logged in as:"); c = new GridBagConstraints(); c.gridy = 2; c.insets = new Insets(5, 5, 5, 5); c.anchor = GridBagConstraints.WEST; panel.add(nameLabel, c); userNameTextField = new JTextField("krisv"); userNameTextField.setPreferredSize(new Dimension(80, 20)); userNameTextField.setSize(new Dimension(80, 20)); c = new GridBagConstraints(); c.gridy = 2; c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.insets = new Insets(5, 5, 5, 5); c.anchor = GridBagConstraints.WEST; panel.add(userNameTextField, c); JButton createItemButton = new JButton("+"); createItemButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { createNewItem(); } }); c = new GridBagConstraints(); c.gridy = 2; c.insets = new Insets(5, 5, 5, 5); c.anchor = GridBagConstraints.EAST; panel.add(createItemButton, c); panel.doLayout(); }
private void showSettingsMenu() { JCheckBox snd = new JCheckBox("Музыка"); snd.setSize(310, 75); snd.setSelected(Commons.PLAY_MUSIC); snd.setLocation(Commons.WIDTH / 2 - 310 / 2, 230); snd.setForeground(Color.GREEN); snd.setFont(new Font("arial", 0, 40)); snd.setBorderPainted(false); snd.setFocusPainted(false); snd.setContentAreaFilled(false); snd.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Commons.PLAY_MUSIC = snd.isSelected(); } }); String[] items = {"Легкая", "Средняя", "Сложная", "Невозможная"}; JComboBox<String> list = new JComboBox<String>(items); switch (Commons.DIFFICULTY) { case Commons.EASY_DIFFICULTY_CLOUDS_CNT: list.setSelectedIndex(0); break; case Commons.MEDIUM_DIFFICULTY_CLOUDS_CNT: list.setSelectedIndex(1); break; case Commons.HARD_DIFFICULTY_CLOUDS_CNT: list.setSelectedIndex(2); break; case Commons.IMPOSSIBLE_DIFFICULTY_CLOUDS_CNT: list.setSelectedIndex(3); break; } list.setSize(310, 40); list.setLocation(Commons.WIDTH / 2 - 310 / 2, 430); list.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int st = list.getSelectedIndex(); switch (st) { case 0: Commons.DIFFICULTY = Commons.EASY_DIFFICULTY_CLOUDS_CNT; break; case 1: Commons.DIFFICULTY = Commons.MEDIUM_DIFFICULTY_CLOUDS_CNT; break; case 2: Commons.DIFFICULTY = Commons.HARD_DIFFICULTY_CLOUDS_CNT; break; case 3: Commons.DIFFICULTY = Commons.IMPOSSIBLE_DIFFICULTY_CLOUDS_CNT; break; } } }); add(list); JLabel diff_lbl = new JLabel(); diff_lbl.setText("Сложность:"); diff_lbl.setFont(new Font("serif", 0, 40)); diff_lbl.setForeground(Color.GREEN); diff_lbl.setSize(300, 75); diff_lbl.setLocation(list.getLocation().x, list.getLocation().y - 100); add(diff_lbl); JButton back = new JButton("Назад"); back.setSize(190, 75); back.setLocation(Commons.WIDTH / 2 - 190 / 2, Commons.HEIGHT - 150); back.setForeground(Color.GREEN); back.setBorderPainted(false); back.setFocusPainted(false); back.setContentAreaFilled(false); back.setFont(new Font("serif", 0, 40)); back.addActionListener(ev -> showMainMenu()); add(back); add(snd); }
public JPanel createPanel() { jtMain.setText("Please enter positive integer values"); jtMain.setSize(300, 15); jtMain.setLocation(250, 120); jtMain.setBackground(Color.lightGray); jlCurv.setText("Curvature Scaling Factor"); jlCurv.setSize(200, 30); jlCurv.setLocation(200, 200); jtCurv.setSize(50, 20); jtCurv.setLocation(450, 205); jtCurv.setText(Double.toString(Prefs.getCurvatureScalingFactor())); addWindowListener( new WindowAdapter() { public void windowOpened(WindowEvent e) { jtCurv.requestFocus(); } }); jlSpeed.setText("Speed Scaling Factor"); jlSpeed.setSize(200, 30); jlSpeed.setLocation(200, 250); jtSpeed.setSize(50, 20); jtSpeed.setLocation(450, 255); jtSpeed.setText(Double.toString(Prefs.getSpeedScalingFactor())); jlSegScheme.setText("Segmentation Scheme"); jlSegScheme.setSize(200, 30); jlSegScheme.setLocation(200, 300); jcSegScheme.setSize(150, 20); jcSegScheme.setLocation(450, 305); int index = 0; int segSchemeIndex = Prefs.getSegScheme(); if (segSchemeIndex == 3) { index = 1; } else if (segSchemeIndex == 4) { index = 2; } jcSegScheme.setSelectedIndex(index); JButton jbSet = new JButton(); jbSet.setLocation(275, 450); jbSet.setText("Set Values"); jbSet.setSize(150, 30); jbSet.setActionCommand("set"); jbSet.addActionListener(this); this.setBackground(Color.WHITE); panel.add(jtMain); panel.add(jlCurv); panel.add(jlSpeed); panel.add(jtCurv); panel.add(jtSpeed); panel.add(jbSet); panel.add(jlSegScheme); panel.add(jcSegScheme); return panel; }
public static void show() { frame = new JFrame("Advanced pathfinding"); frame.setSize(800, 720); DrawPanel panel = new DrawPanel(); panel.setSize(700, 700); frame.add(panel); Integer items[] = new Integer[5]; for (int i = 1; i < 6; i++) { items[i - 1] = i; } JComboBox comboBox = new JComboBox(items); JLabel label = new JLabel("Размер объекта:"); panel.add(comboBox); panel.add(label); comboBox.setSize(40, 20); label.setSize(120, 20); comboBox.setLocation(730, 20); label.setLocation(620, 20); comboBox.setVisible(true); label.setVisible(true); ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JComboBox box = (JComboBox) e.getSource(); Integer item = (Integer) box.getSelectedItem(); panel.size = item; panel.aim = null; } }; MouseListener mouseListener = new MouseListener() { int tick = 0; Cell aim; @Override public void mouseClicked(MouseEvent e) { if ((e.getX() > 600) || (e.getY() > 600)) { return; } aim = new Cell(e.getX() / panel.grid.cSize, e.getY() / panel.grid.cSize); panel.aim = aim; } @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} }; frame.setVisible(true); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); panel.addMouseListener(mouseListener); comboBox.addActionListener(actionListener); }
MovieAdd() { setTitle("Dodaj Film"); setSize(300, 355); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); this.setResizable(false); setLayout(null); frame = this; /** ***************************************************** */ Mov = DataBase.getInstance().getMoviesDao(); Cat = DataBase.getInstance().getCategoriesDao(); CatMov = DataBase.getInstance().getCatMovDao(); Vector<String> catNamesList = DataBase.returnCategoriesList(); /** ******************************************************* */ categories = new JComboBox(catNamesList); label1.setLocation(10, 10); label1.setSize(60, 25); categories.setLocation(80, 10); categories.setSize(200, 25); label2.setLocation(10, 50); label2.setSize(60, 25); name.setLocation(80, 50); name.setSize(200, 25); label3.setLocation(10, 90); label3.setSize(60, 25); desc.setLocation(80, 90); desc.setSize(200, 150); desc.setFont(new Font("Dialog", Font.PLAIN, 12)); label4.setLocation(10, 250); label4.setSize(60, 25); fileButton.setLocation(80, 250); fileButton.setSize(200, 25); button.setLocation(220, 290); button.setSize(60, 25); add(label1); add(categories); add(label2); add(name); add(label3); add(desc); add(label4); add(fileButton); add(button); fileButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { int returnVal = fileChooser.showOpenDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { choosenFileName = fileChooser.getSelectedFile().getAbsolutePath(); } } }); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Movies newMovie = new Movies(); newMovie.setName(name.getText()); newMovie.setContent(desc.getText()); newMovie.setFile(choosenFileName); newMovie.setCreated(new Date()); try { Mov.create(newMovie); } catch (SQLException ex) { System.out.println("Błąd przy zapisywaniu nowego filmu... MovieAdd " + ex); } String catName = (String) categories.getSelectedItem(); Categories category = new Categories(); try { category = Cat.queryForEq("name", catName).get(0); } catch (SQLException ex) { System.out.println("Błąd przy szukaniu kategorii... MovieAdd " + ex); } CatMovies catMovLink = new CatMovies(); catMovLink.setMovie(newMovie); catMovLink.setCategory(category); try { CatMov.create(catMovLink); } catch (SQLException ex) { System.out.println("Błąd przy zapisywaniu kategoria-film... MovieAdd " + ex); } frame.setVisible(false); } }); }
// private void createComponent(){ // // } public void init() { fLogin = new JFrame("Login"); Container fc = fLogin.getContentPane(); JPanel jpBtn = new JPanel(); // add jpanel, contains 2 buttons JButton btnLogin = new JButton("Login"); JButton btnQuit = new JButton("Quit"); btnLogin.setActionCommand("Login"); btnQuit.setActionCommand("Quit"); jpBtn.add(btnLogin); jpBtn.add(btnQuit); JPanel jpTextField = new JPanel(); // add jpanel contains 2label and 2 textfield jlName = new JLabel("User Name:"); jlPwd = new JLabel("Password :"******"User001", 15); jfPwd = new JTextField("user001", 15); jlTips = new JLabel(""); jlTips.setForeground(Color.red); jlTips.setSize(15, 15); jpTextField.add(jlName); jpTextField.add(jfName); jpTextField.add(jlPwd); jpTextField.add(jfPwd); jpTextField.add(jlTips); // f String output[] = {"GUI", "Konsole"}; try { jfIp = new JTextField(InetAddress.getLocalHost().getHostAddress().toString()); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); jfIp.setText("127.0.0.1"); } jfIp.setSize(20, 10); Jclass = new JComboBox(output); Jclass.setSize(150, 80); JPanel jcontainer = new JPanel(); JLabel jblServer = new JLabel("Server Ip"); JPanel jServer = new JPanel(); jServer.add(jblServer); jServer.add(jfIp); jcontainer.setLayout(new BorderLayout()); jcontainer.add(jpTextField, "Center"); jcontainer.add(Jclass, "South"); jcontainer.add(jServer, "North"); // fc.add(jpTextField,"North"); fc.add(jpBtn, "South"); fc.add(jcontainer, "Center"); // Event for window closing fLogin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /*fLogin.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ // fLogin.dispose(); System.exit(0); } });*/ btnQuit.addActionListener(this); btnLogin.addActionListener(this); fLogin.setSize(300, 200); setFrameCenter(fLogin, false); fLogin.setVisible(true); }
public BurtgehHuudas() { super("Бүртгэл хуудас"); Container con = getContentPane(); con.setLayout(null); // haryalagdah tenhim JLabel lbl1 = new JLabel("Харъяалагдах тэнхим:"); lbl1.setLocation(30, 30); lbl1.setSize(200, 30); con.add(lbl1); JComboBox combo1 = new JComboBox(); try { String s = "SELECT * FROM tenhim"; ResultSet rs = DatabaseTools.runQuery(s); while (rs.next()) { combo1.addItem(rs.getString(2)); } } catch (Exception e) { } combo1.setLocation(200, 30); combo1.setSize(200, 30); con.add(combo1); JLabel lb1 = new JLabel("Сонгоно уу?"); lb1.setLocation(450, 30); lb1.setSize(200, 30); con.add(lb1); // oyutanii code JLabel lbl2 = new JLabel("Код:"); lbl2.setLocation(30, 70); lbl2.setSize(200, 30); con.add(lbl2); JTextField txt1 = new JTextField(); txt1.setLocation(200, 70); txt1.setSize(200, 30); con.add(txt1); JLabel lb2 = new JLabel("Жишээ нь:SW001"); lb2.setLocation(450, 70); lb2.setSize(200, 30); con.add(lb2); // oyutanii ovog JLabel lbl3 = new JLabel("Овог:"); lbl3.setLocation(30, 110); lbl3.setSize(200, 30); con.add(lbl3); JTextField txt2 = new JTextField(); txt2.setLocation(200, 110); txt2.setSize(200, 30); con.add(txt2); JLabel lb3 = new JLabel("18 тэмдэгт"); lb3.setLocation(450, 110); lb3.setSize(200, 30); con.add(lb3); // oyutanii ner JLabel lbl4 = new JLabel("Нэр:"); lbl4.setLocation(30, 150); lbl4.setSize(200, 30); con.add(lbl4); JTextField txt3 = new JTextField(); txt3.setLocation(200, 150); txt3.setSize(200, 30); con.add(txt3); JLabel lb4 = new JLabel("18 тэмдэгт"); lb4.setLocation(450, 150); lb4.setSize(200, 30); con.add(lb4); // nuuts ug JLabel lbl5 = new JLabel("Нууц үг:"); lbl5.setLocation(30, 190); lbl5.setSize(200, 30); con.add(lbl5); JPasswordField pass1 = new JPasswordField(); pass1.setLocation(200, 190); pass1.setSize(200, 30); con.add(pass1); JLabel lb5 = new JLabel("Ихдээ 10 тэмдэгт"); lb5.setLocation(450, 190); lb5.setSize(200, 30); con.add(lb5); // nuuts ug davtalt JLabel lbl6 = new JLabel("Нууц үг давталт:"); lbl6.setLocation(30, 230); lbl6.setSize(200, 30); con.add(lbl6); JPasswordField pass2 = new JPasswordField(); pass2.setLocation(200, 230); pass2.setSize(200, 30); con.add(pass2); // huis JLabel lbl7 = new JLabel("Хүйс:"); lbl7.setLocation(30, 270); lbl7.setSize(200, 30); con.add(lbl7); JRadioButton rd1 = new JRadioButton("Эр"); rd1.setLocation(200, 270); rd1.setSize(50, 30); con.add(rd1); JRadioButton rd2 = new JRadioButton("Эм"); rd2.setLocation(260, 270); rd2.setSize(50, 30); con.add(rd2); ButtonGroup huisGroup = new ButtonGroup(); huisGroup.add(rd1); huisGroup.add(rd2); JLabel lb7 = new JLabel("Сонгодог байх"); lb7.setLocation(450, 270); lb7.setSize(200, 30); con.add(lb7); // elssen on JLabel lbl8 = new JLabel("Элссэн он:"); lbl8.setLocation(30, 310); lbl8.setSize(200, 30); con.add(lbl8); JTextField txt5 = new JTextField(); txt5.setLocation(200, 310); txt5.setSize(200, 30); con.add(txt5); JLabel lb8 = new JLabel("Жишээ:2011"); lb8.setLocation(450, 310); lb8.setSize(200, 30); con.add(lb8); // tsagiin/undsen JLabel lbl9 = new JLabel("Цагийн/Үндсэн:"); lbl9.setLocation(30, 350); lbl9.setSize(200, 30); con.add(lbl9); JCheckBox ch1 = new JCheckBox("Цаг"); ch1.setLocation(200, 340); ch1.setSize(50, 50); con.add(ch1); JCheckBox ch2 = new JCheckBox("Үндсэн"); ch2.setLocation(250, 340); ch2.setSize(80, 50); con.add(ch2); ButtonGroup checkgroup = new ButtonGroup(); checkgroup.add(ch1); checkgroup.add(ch2); JLabel lb9 = new JLabel("Олныг сонгож болох"); lb9.setLocation(450, 350); lb9.setSize(200, 30); con.add(lb9); // zereg JLabel lbl10 = new JLabel("Зэрэг:"); lbl10.setLocation(30, 390); lbl10.setSize(200, 30); con.add(lbl10); JComboBox combo2 = new JComboBox(); try { String s = "SELECT * FROM zereg"; ResultSet rs = DatabaseTools.runQuery(s); while (rs.next()) { combo2.addItem(rs.getString(2)); } } catch (Exception e) { } combo2.setLocation(200, 390); combo2.setSize(200, 30); con.add(combo2); // torol JLabel lbl11 = new JLabel("Төрөл:"); lbl11.setLocation(30, 430); lbl11.setSize(200, 30); con.add(lbl11); String str3[] = { "Захирал", "Бакалавр1", "Бакалавр2", "Бакалавр3", "Бакалавр4", }; JComboBox combo3 = new JComboBox(str3); combo3.setLocation(200, 430); combo3.setSize(200, 30); con.add(combo3); // geriin utas JLabel lbl12 = new JLabel("Гэрийн утас:"); lbl12.setLocation(30, 470); lbl12.setSize(200, 30); con.add(lbl12); JTextField txt6 = new JTextField(); txt6.setLocation(200, 470); txt6.setSize(200, 30); con.add(txt6); JLabel lb12 = new JLabel("Ихдээ 20 тэмдэгт"); lb12.setLocation(450, 470); lb12.setSize(200, 30); con.add(lb12); // gar utas JLabel lbl13 = new JLabel("Гар утас:"); lbl13.setLocation(30, 510); lbl13.setSize(200, 30); con.add(lbl13); JTextField txt7 = new JTextField(); txt7.setLocation(200, 510); txt7.setSize(200, 30); con.add(txt7); JLabel lb13 = new JLabel("Ихдээ 20 тэмдэгт"); lb13.setLocation(450, 510); lb13.setSize(200, 30); con.add(lb13); // geriin hayag JLabel lbl14 = new JLabel("Гэрийн хаяг:"); lbl14.setLocation(30, 550); lbl14.setSize(200, 30); con.add(lbl14); JTextArea ta1 = new JTextArea(); ta1.setLocation(200, 550); ta1.setSize(250, 90); con.add(ta1); JLabel lb14 = new JLabel("Ихдээ 200 тэмдэгт"); lb14.setLocation(500, 550); lb14.setSize(200, 30); con.add(lb14); // mail hayag JLabel lbl15 = new JLabel("Майл хаяг:"); lbl15.setLocation(30, 650); lbl15.setSize(200, 30); con.add(lbl15); JTextField txt8 = new JTextField(); txt8.setLocation(200, 650); txt8.setSize(200, 30); con.add(txt8); JLabel lb15 = new JLabel("Ихдээ 100 тэмдэгт"); lb15.setLocation(450, 650); lb15.setSize(200, 30); con.add(lb15); // torson odor JLabel lbl16 = new JLabel("Төрсөн өдөр:"); lbl16.setLocation(30, 690); lbl16.setSize(200, 30); con.add(lbl16); String year1[] = new String[116]; for (int on = 0; on < 116; on++) { year1[on] = Integer.toString(1900 + on); } JComboBox year = new JComboBox(year1); year.setMaximumRowCount(8); year.setLocation(200, 690); year.setSize(60, 30); con.add(year); JLabel lbl161 = new JLabel("Он"); lbl161.setLocation(265, 690); lbl161.setSize(30, 30); con.add(lbl161); String month1[] = new String[12]; for (int sar = 0; sar < 12; sar++) { month1[sar] = Integer.toString(1 + sar); } JComboBox month = new JComboBox(month1); month.setMaximumRowCount(8); month.setLocation(290, 690); month.setSize(60, 30); con.add(month); JLabel lbl162 = new JLabel("Сар"); lbl162.setLocation(355, 690); lbl162.setSize(30, 30); con.add(lbl162); String day1[] = new String[31]; for (int odor = 0; odor < 31; odor++) { day1[odor] = Integer.toString(1 + odor); } JComboBox day = new JComboBox(day1); day.setLocation(385, 690); day.setSize(60, 30); con.add(day); JLabel lbl163 = new JLabel("Өдөр"); lbl163.setLocation(450, 690); lbl163.setSize(50, 30); con.add(lbl163); JLabel lb16 = new JLabel("3-н combobox байх"); lb16.setForeground(Color.red); lb16.setLocation(550, 690); lb16.setSize(200, 30); con.add(lb16); // nemeh JButton bt1 = new JButton("Нэмэх"); bt1.setForeground(Color.blue); bt1.setLocation(600, 30); bt1.setSize(100, 40); bt1.addActionListener( ae -> { String stuLastName = txt2.getText(); String stuFirstName = txt3.getText(); String huis; if (rd1.isSelected()) huis = "эр"; else huis = "эм"; String elssenOn = txt5.getText(); String address = ta1.getText(); String phone = txt7.getText(); String mail = txt8.getText(); String code = txt1.getText(); String query1 = "insert into student(stu_lastname, stu_firstname,stu_sex,stu_elssenOn,stu_address,stu_phone,stu_mail,stu_code)" + "values('" + stuLastName + "','" + stuFirstName + "','" + huis + "','" + elssenOn + "','" + address + "','" + phone + "','" + mail + "','" + code + "')"; DatabaseTools.runQuery(query1); JOptionPane.showMessageDialog(null, "Амжилттай нэмэгдлээ."); this.dispose(); }); con.add(bt1); // tseverleh JButton bt4 = new JButton("Цэвэрлэх"); bt4.setForeground(Color.blue); bt4.setLocation(600, 180); bt4.setSize(100, 40); con.add(bt4); setLocation(800, 350); setSize(750, 800); setVisible(true); setResizable(false); }
private void setBoxSize(Dimension dimension) { box.setMinimumSize(dimension); box.setMaximumSize(dimension); box.setSize(dimension); box.setPreferredSize(dimension); }
/** * Constructs the dialog window * * @param p Parent GUI */ public RegionEditorDialog(MapEditorGUI p) { parent = p; setLayout(null); /* * Initialize naming field */ JLabel l = new JLabel("Name"); l.setSize(l.getPreferredSize()); l.setLocation(10, 10); nameField = new JTextField("plains"); nameField.setSize(200, 24); nameField.setLocation(10, 32); add(l); add(nameField); /* * Initialize encounter spinner */ l = new JLabel("Encounter rate"); l.setSize(l.getPreferredSize()); l.setLocation(10, 64); eRateSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 20, 1)); eRateSpinner.setSize(eRateSpinner.getPreferredSize()); eRateSpinner.setLocation(210 - eRateSpinner.getWidth(), 62); add(l); add(eRateSpinner); /* * Initialize Terrain selector */ l = new JLabel("Terrain"); l.setSize(l.getPreferredSize()); l.setLocation(10, 96); terrain = new JComboBox(ToolKit.terrains); terrain.setSize(200, 24); terrain.setLocation(10, 120); add(l); add(terrain); /* * Initialize formation list */ l = new JLabel("Formations"); l.setSize(l.getPreferredSize()); l.setLocation(10, 156); fList = new JList(formations); fPane = new JScrollPane(fList); fPane.setSize(200, 160); fPane.setLocation(10, 172); add(l); add(fPane); /* * Initialize buttons */ okButton = new JButton("OK"); okButton.setSize(80, 24); okButton.setLocation(20, 380); okButton.addActionListener(this); cancelButton = new JButton("Cancel"); cancelButton.setSize(80, 24); cancelButton.setLocation(120, 380); cancelButton.addActionListener(this); add(okButton); add(cancelButton); fRemButton = new JButton("-"); fRemButton.setSize(fRemButton.getPreferredSize()); fRemButton.setLocation(210 - fRemButton.getWidth(), 335); fAddButton = new JButton("+"); fAddButton.setSize(fAddButton.getPreferredSize()); fAddButton.setLocation(fRemButton.getX() - fAddButton.getWidth(), 335); fEdtButton = new JButton("Edit"); fEdtButton.setSize(100, 24); fEdtButton.setLocation(10, 335); fAddButton.addActionListener(this); fRemButton.addActionListener(this); fEdtButton.addActionListener(this); add(fAddButton); add(fRemButton); add(fEdtButton); /* * Initialize dialog window */ setSize(230, 450); setVisible(true); setModal(true); setResizable(false); setTitle("Region Editor"); setLocationRelativeTo(parent); }
public LabelFilterPanel(final boolean enableHilite) { super("Labels/Filter", true); GridBagConstraints gbc = new GridBagConstraints(); setLayout(new GridBagLayout()); gbc.gridx = 0; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.gridheight = 1; gbc.weightx = 1; gbc.weighty = 0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.BOTH; m_ruleFilter = new RulebasedLabelFilter<L>(); m_hiliteFilter = new NameSetbasedLabelFilter<L>(false); m_textFields = new ArrayList<JTextField>(); m_activeLabels = new Vector<L>(); m_jLabelList = new JList(); m_jLabelList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); m_contextMenu = createContextMenu(enableHilite); // TODO m_jLabelList.addMouseListener( new MouseAdapter() { /** {@inheritDoc} */ @Override public void mousePressed(final MouseEvent evt) { if (evt.getButton() == MouseEvent.BUTTON3) { showMenu(evt); } } }); m_jLabelList.setCellRenderer( new DefaultListCellRenderer() { private static final long serialVersionUID = 1L; @Override public Component getListCellRendererComponent( final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); c.setForeground(Color.BLACK); if ((m_hilitedLabels != null) && m_hilitedLabels.contains(value.toString())) { if (isSelected) { c.setBackground(LabelingColorTableUtils.HILITED_SELECTED); } else { c.setBackground(LabelingColorTableUtils.HILITED); } } else if (isSelected) { c.setBackground(LabelingColorTableUtils.SELECTED); } else { c.setBackground(LabelingColorTableUtils.STANDARD); } return c; } }); m_scrollPane = new JScrollPane(m_jLabelList); final JPanel confirmationPanel = new JPanel(); confirmationPanel.setLayout(new BoxLayout(confirmationPanel, BoxLayout.X_AXIS)); m_textFieldsPanel = new JPanel(); m_textFieldsPanel.setLayout(new BoxLayout(m_textFieldsPanel, BoxLayout.Y_AXIS)); final JButton filterButton = new JButton("Filter"); filterButton.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { doFilter(); } }); final JButton addButton = new JButton("+"); addButton.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { m_filterTabbs.setSelectedIndex(1); addTextField(""); } }); m_operatorBox = new JComboBox(RulebasedLabelFilter.Operator.values()); m_operatorBox.setSize(new Dimension(40, 22)); confirmationPanel.add(addButton); confirmationPanel.add(m_operatorBox); confirmationPanel.add(filterButton); m_filters = new JScrollPane(m_textFieldsPanel); m_scrollPane.setMaximumSize(new Dimension(200, 1000)); m_scrollPane.setPreferredSize(new Dimension(200, 200)); m_filterTabbs.add("Labels", m_scrollPane); m_filterTabbs.add("Filter Rules", m_filters); gbc.weighty = 1; add(m_filterTabbs, gbc); gbc.weighty = 0; gbc.gridheight = GridBagConstraints.REMAINDER; add(confirmationPanel, gbc); if (enableHilite) { m_hilitedLabels = new HashSet<String>(); } }
/** Display the GUI */ private void initGUI() { try { this.setTitle(PLUGIN_NAME + " - " + PLUGIN_VERSION); { jSplitPane1 = new JSplitPane(); getContentPane().add(jSplitPane1, BorderLayout.CENTER); jSplitPane1.setPreferredSize(new java.awt.Dimension(500, 500)); jSplitPane1.setDividerLocation(200); jSplitPane1.setResizeWeight(0.5); { jPanelRight = new JPanel(); GridBagLayout jPanelRightLayout = new GridBagLayout(); jPanelRightLayout.rowWeights = new double[] {0.0, 0.0, 0.5, 0.0}; jPanelRightLayout.rowHeights = new int[] {7, 7, 7, 7}; jPanelRightLayout.columnWeights = new double[] {0.0, 0.5, 0.0}; jPanelRightLayout.columnWidths = new int[] {4, 7, 7}; jSplitPane1.add(jPanelRight, JSplitPane.RIGHT); jPanelRight.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jPanelRight.setLayout(jPanelRightLayout); jPanelRight.setMinimumSize(new java.awt.Dimension(1, 1)); { jButtonCancel = new JButton(); jPanelRight.add( jButtonCancel, new GridBagConstraints( 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 10, 10, 0), 0, 0)); jButtonCancel.setText("Quit"); jButtonCancel.addActionListener( new ActionListener() { // Close the GUI @Override public void actionPerformed(ActionEvent e) { quitGui(); } }); } { jButtonOK = new JButton(); jPanelRight.add( jButtonOK, new GridBagConstraints( 2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 10, 10), 0, 0)); jButtonOK.setText("Parse"); jButtonOK.setEnabled(false); jButtonOK.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean valid = checkValid(); if (valid) { addCurrentExpressionToHistory(); launchCalculation(); } } }); } { jScrollPane1 = new JScrollPane(); jPanelRight.add( jScrollPane1, new GridBagConstraints( 0, 2, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0)); jScrollPane1.setOpaque(false); jScrollPane1.setBorder(null); jScrollPane1.getViewport().setOpaque(false); jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); { jTextAreaInfo = new JEditorPane(); jTextAreaInfo.setBorder(null); jScrollPane1.setViewportView(jTextAreaInfo); jTextAreaInfo.setFont(new Font("Arial", Font.PLAIN, 10)); jTextAreaInfo.setEditable(false); jTextAreaInfo.setOpaque(false); jTextAreaInfo.setContentType("text/html"); jTextAreaInfo.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true); } } } { jPanelLeft = new JPanel(); GridBagLayout jPanelLeftLayout = new GridBagLayout(); jPanelLeftLayout.rowWeights = new double[] {0.0, 0.0, 1.0, 0.0}; jPanelLeftLayout.rowHeights = new int[] {7, 7, -33, 50}; jPanelLeftLayout.columnWeights = new double[] {0.1}; jPanelLeftLayout.columnWidths = new int[] {7}; jPanelLeft.setLayout(jPanelLeftLayout); jSplitPane1.add(jPanelLeft, JSplitPane.LEFT); jPanelLeft.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); jPanelLeft.setPreferredSize(new java.awt.Dimension(198, 470)); { jLabelExpression = new JLabel(); jPanelLeft.add( jLabelExpression, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 0), 0, 0)); jLabelExpression.setText("Expression:"); jLabelExpression.setPreferredSize(new java.awt.Dimension(196, 16)); } { expressionField = new JComboBox(expression_history); expressionField.setEditable(true); expressionField.setBorder(new LineBorder(new java.awt.Color(252, 117, 0), 1, false)); expressionField.setSize(12, 18); jPanelLeft.add( expressionField, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0)); expressionField.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Two action events are fired on edit: one for editing the textfield, one for // changing // the combo box selection. We only catch the edition. if (e.getActionCommand().equalsIgnoreCase("comboBoxEdited")) { boolean valid = checkValid(); if (valid) { addCurrentExpressionToHistory(); launchCalculation(); } } } }); } { jScrollPaneImages = new JScrollPane(); jPanelLeft.add( jScrollPaneImages, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 0, 10, 0), 0, 0)); jScrollPaneImages.setPreferredSize(new java.awt.Dimension(196, 267)); jScrollPaneImages.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jScrollPaneImages.getVerticalScrollBar().setUnitIncrement(20); { jPanelImages = new JPanel(); jScrollPaneImages.setViewportView(jPanelImages); jPanelImages.setLayout(null); jPanelImages.setPreferredSize(new java.awt.Dimension(190, 45)); } } { jPanelLeftButtons = new JPanel(); jPanelLeft.add( jPanelLeftButtons, new GridBagConstraints( 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 0, 10, 0), 0, 0)); jPanelLeftButtons.setLayout(null); jPanelLeftButtons.setPreferredSize(new java.awt.Dimension(196, 35)); jPanelLeftButtons.setSize(196, 35); { jButtonPlus = new JButton(); jPanelLeftButtons.add(jButtonPlus); jButtonPlus.setText("+"); jButtonPlus.setBounds(9, -2, 35, 35); jButtonPlus.setFont(new java.awt.Font("Times New Roman", 0, 18)); jButtonPlus.setOpaque(true); jButtonPlus.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { addImageBox(); } }); } { jButtonMinus = new JButton(); jPanelLeftButtons.add(jButtonMinus); jButtonMinus.setText("—"); jButtonMinus.setBounds(46, -2, 35, 35); jButtonMinus.setFont(new java.awt.Font("Arial", 0, 12)); jButtonMinus.setOpaque(true); jButtonMinus.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { removeImageBox(); } }); } } jPanelLeft.addComponentListener( new ComponentListener() { public void componentShown(ComponentEvent e) {} public void componentResized(ComponentEvent e) { refreshImageBoxes(); } public void componentMoved(ComponentEvent e) {} public void componentHidden(ComponentEvent e) {} }); } } pack(); setSize(500, 500); } catch (Exception e) { e.printStackTrace(); } }
public BorrowerSearchPanel(BorrowerView borrowerView, Controller mySession) { super(new BorderLayout()); parent = borrowerView; this.mySession = mySession; listModel = new DefaultListModel(); // Create the list and put it in a scroll pane. list = new JList(listModel); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setSelectedIndex(0); list.addListSelectionListener(this); list.setVisibleRowCount(5); JScrollPane listScrollPane = new JScrollPane(list); /* employeeName = new JTextField(10); employeeName.addActionListener(hireListener); employeeName.getDocument().addDocumentListener(hireListener); String name = listModel.getElementAt( list.getSelectedIndex()).toString();*/ // Create a panel that uses BoxLayout. JPanel buttonPane = new JPanel(); buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(listScrollPane, BorderLayout.CENTER); JPanel panel = new JPanel(); listScrollPane.setColumnHeaderView(panel); JLabel lblSearchForBooks = new JLabel("Search For Books"); panel.add(lblSearchForBooks); add(buttonPane, BorderLayout.PAGE_END); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS)); JSplitPane splitPane = new JSplitPane(); splitPane.setContinuousLayout(true); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); buttonPane.add(splitPane); JPanel panel_1 = new JPanel(); splitPane.setLeftComponent(panel_1); cmboKeyWords = new JComboBox(); cmboKeyWords.setModel(new DefaultComboBoxModel(new String[] {"Title", "Author", "Subject"})); cmboKeyWords.setSize(100, 75); panel_1.add(cmboKeyWords); searchArgument = new JTextField(); panel_1.add(searchArgument); searchArgument.setColumns(10); JPanel panel_2 = new JPanel(); splitPane.setRightComponent(panel_2); btnSearch = new JButton("Search"); btnSearch.addActionListener(new SearchListener()); panel_2.add(btnSearch); btbPlaceOnHold = new JButton("Place Hold Request"); btbPlaceOnHold.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("yep"); PlaceHoldRequestDialog test = new PlaceHoldRequestDialog( getInstance(), getLoggedInUserBID(), getInstance().mySession); test.setVisible(true); } }); panel_2.add(btbPlaceOnHold); }