List of usage examples for javax.swing BorderFactory createTitledBorder
public static TitledBorder createTitledBorder(Border border)
From source file:com.mirth.connect.client.ui.attachments.IdentityAttachmentDialog.java
private void initComponents() { setBackground(UIConstants.BACKGROUND_COLOR); getContentPane().setBackground(getBackground()); propertiesPanel = new JPanel(); propertiesPanel.setBackground(getBackground()); propertiesPanel.setBorder(BorderFactory.createTitledBorder("Properties")); mimeTypeLabel = new JLabel("MIME Type:"); mimeTypeField = new JTextField(); separator = new JSeparator(SwingConstants.HORIZONTAL); closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { @Override//from w w w. ja v a 2 s . c o m public void actionPerformed(ActionEvent evt) { close(); } }); }
From source file:com.bsoft.baseframe.baseframe_utils.beanUtils.Classgenerator.java
/** * ???/*from w ww . j av a2s .c o m*/ */ public Classgenerator() { setTitle("?"); setSize(WIDTH, HEIGHT); setLocationRelativeTo(null); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(2, 1)); JPanel _beanPanel = new JPanel(); _beanPanel.setBorder(BorderFactory.createTitledBorder("?")); JPanel _otherPanel = new JPanel(); _otherPanel.setBorder(BorderFactory.createTitledBorder("?")); JLabel _tbLabel = new JLabel("??*"); _tb = new JTextField(25); _beanPanel.add(_tbLabel); _beanPanel.add(_tb); JLabel _stbbLabel = new JLabel("??*"); _stb = new JTextField(25); _beanPanel.add(_stbbLabel); _beanPanel.add(_stb); JLabel _ibatisLabel = new JLabel("IBTS*"); _ibatis = new JTextField(25); _beanPanel.add(_ibatisLabel); _beanPanel.add(_ibatis); JLabel _svLabel = new JLabel("SERVICE"); _sv = new JTextField(23); _otherPanel.add(_svLabel); _otherPanel.add(_sv); // JLabel _sviLabel = new JLabel("??*"); // _zwmc = new JTextField("?",25); // _zwmc.setEditable(false); // _otherPanel.add(_sviLabel); // _otherPanel.add(_zwmc); JLabel _detail = new JLabel("(?ServiceService??,"); JLabel _detail2 = new JLabel("??Service???.impl)"); _detail.setFont(new Font("", Font.ITALIC, 12)); _detail2.setFont(new Font("", Font.ITALIC, 12)); _otherPanel.add(_detail); _otherPanel.add(_detail2); panel.add(_beanPanel); panel.add(_otherPanel); add(panel, BorderLayout.CENTER); JPanel btnPanel = new JPanel(); JButton _saveBtn = new JButton("?"); _saveBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int msg_code = clickSaveBtn(e); showMsg(msg_code); } }); JButton _restBtn = new JButton("?"); //? _restBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { _tb.setText(null); _stb.setText(null); _ibatis.setText(null); _sv.setText(null); // _svi.setText(null); } }); btnPanel.add(_saveBtn); btnPanel.add(_restBtn); add(btnPanel, BorderLayout.SOUTH); }
From source file:de.codesourcery.eve.skills.ui.components.impl.TotalItemVolumeComponent.java
@Override protected JPanel createPanel() { textField.setColumns(10);/* w ww. ja va 2s . c om*/ textField.setEditable(false); textField.setHorizontalAlignment(JTextField.TRAILING); JPanel textFieldPanel = new JPanel(); textField.setLayout(new GridBagLayout()); textFieldPanel.setBorder(BorderFactory.createTitledBorder(title)); textFieldPanel.add(textField, constraints(0, 0).weightX(0.5).weightY(0.5).resizeHorizontally().useRelativeWidth().end()); setVolumeLabel(0.0d); return textFieldPanel; }
From source file:com.jcraft.weirdx.XRexec.java
public XRexec(String myName, int num) { try {//from w w w. java 2 s.co m InetAddress local = null; if (myName != null && myName.length() > 0) { local = InetAddress.getByName(myName); } else { local = InetAddress.getLocalHost(); } display = local.getHostName() + ":" + num + ".0"; } catch (Exception e) { display = "localhost:" + num + ".0"; LOG.error(e); } JFrame jframe = new JFrame(); Container cpane = jframe.getContentPane(); cpane.setLayout(new GridLayout(0, 1)); JPanel jpanel = null; jpanel = new JPanel(); jpanel.setBorder(BorderFactory.createTitledBorder("Host")); jpanel.setLayout(new BorderLayout()); host.setText(""); host.setMinimumSize(new Dimension(50, 25)); host.setEditable(true); jpanel.add(host, "Center"); cpane.add(jpanel); jpanel = new JPanel(); jpanel.setBorder(BorderFactory.createTitledBorder("User")); jpanel.setLayout(new BorderLayout()); name.setText(""); name.setMinimumSize(new Dimension(50, 25)); name.setEditable(true); jpanel.add(name, "Center"); cpane.add(jpanel); jpanel = new JPanel(); jpanel.setBorder(BorderFactory.createTitledBorder("Password")); jpanel.setLayout(new BorderLayout()); passwd.setMinimumSize(new Dimension(50, 25)); passwd.setEditable(true); jpanel.add(passwd, "Center"); cpane.add(jpanel); jpanel = new JPanel(); jpanel.setBorder(BorderFactory.createTitledBorder("Command with Absolute Path")); jpanel.setLayout(new BorderLayout()); command.setText(""); command.setMinimumSize(new Dimension(50, 25)); command.setEditable(true); jpanel.add(command, "Center"); command.addActionListener(this); cpane.add(jpanel); jpanel = new JPanel(); jpanel.add(rexec, "Center"); rexec.addActionListener(this); cpane.add(jpanel); jframe.pack(); jframe.setVisible(true); }
From source file:net.chunkyhosting.Roe.computer.CHGManager.gui.panels.ServerList.java
public void retriveServerList() { try {/*from w w w.ja v a2 s. c om*/ JSONObject json = CHGManager.getInstance().getGameCPX() .performAPICall(new String[] { "command", "service_list" }); for (int x = 0; x < json.getJSONArray("result").length(); x++) { JSONObject server = json.getJSONArray("result").getJSONObject(x); Server theServer = new Server(); ServerDisplay test = new ServerDisplay(server); test.setBorder(BorderFactory.createTitledBorder("Server 1")); test.setAlignmentX(Component.CENTER_ALIGNMENT); test.setMaximumSize(new Dimension(99999, 80)); add(test); } /*ServerDisplay test2 = new ServerDisplay(); test2.setBorder(BorderFactory.createTitledBorder("Server 2")); test2.setAlignmentX(Component.CENTER_ALIGNMENT); test2.setMaximumSize(new Dimension(99999, 70)); add(test2);*/ } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (EmptyAPIResponseException e) { e.printStackTrace(); } }
From source file:ambit.ui.data.AmbitResultViewer.java
public AmbitResultViewer(String caption) { super(); addWidgets(); this.caption = caption; setBorder(BorderFactory.createTitledBorder(caption)); }
From source file:io.github.jeremgamer.editor.panels.Actions.java
public Actions(final JFrame frame, final ActionPanel ap) { this.frame = frame; this.setBorder(BorderFactory.createTitledBorder("")); JButton add = null;/*from w w w . jav a2 s . c o m*/ try { add = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("add.png")))); } catch (IOException e) { e.printStackTrace(); } add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { JOptionPane jop = new JOptionPane(); @SuppressWarnings("static-access") String name = jop.showInputDialog(null, "Nommez l'action :", "Crer une action", JOptionPane.QUESTION_MESSAGE); if (name != null) { for (int i = 0; i < data.getSize(); i++) { if (data.get(i).equals(name)) { name += "1"; } } data.addElement(name); new ActionSave(name); OtherPanel.updateLists(); ButtonPanel.updateLists(); ActionPanel.updateLists(); } } catch (IOException e) { e.printStackTrace(); } } }); JButton remove = null; try { remove = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png")))); } catch (IOException e) { e.printStackTrace(); } remove.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { if (actionList.getSelectedValue() != null) { File file = new File("projects/" + Editor.getProjectName() + "/actions/" + actionList.getSelectedValue() + ".rbd"); JOptionPane jop = new JOptionPane(); @SuppressWarnings("static-access") int option = jop.showConfirmDialog(null, "tes-vous sr de vouloir supprimer cette action?", "Avertissement", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (option == JOptionPane.OK_OPTION) { if (actionList.getSelectedValue().equals(ap.getFileName())) { ap.setFileName(""); } ap.hide(); file.delete(); data.remove(actionList.getSelectedIndex()); OtherPanel.updateLists(); ButtonPanel.updateLists(); } } } catch (NullPointerException npe) { npe.printStackTrace(); } } }); JPanel buttons = new JPanel(); buttons.setLayout(new BoxLayout(buttons, BoxLayout.LINE_AXIS)); buttons.add(add); buttons.add(remove); updateList(); actionList.addMouseListener(new MouseAdapter() { @SuppressWarnings("unchecked") public void mouseClicked(MouseEvent evt) { JList<String> list = (JList<String>) evt.getSource(); if (evt.getClickCount() == 2) { int index = list.locationToIndex(evt.getPoint()); if (isOpen == false) { ap.show(); ap.load(new File("projects/" + Editor.getProjectName() + "/actions/" + list.getModel().getElementAt(index) + ".rbd")); previousSelection = list.getSelectedValue(); isOpen = true; } else { try { if (previousSelection.equals(list.getModel().getElementAt(index))) { ap.hide(); previousSelection = list.getSelectedValue(); list.clearSelection(); isOpen = false; } else { ap.hideThenShow(); previousSelection = list.getSelectedValue(); ap.load(new File("projects/" + Editor.getProjectName() + "/actions/" + list.getModel().getElementAt(index) + ".rbd")); } } catch (NullPointerException npe) { ap.hide(); list.clearSelection(); } } } else if (evt.getClickCount() == 3) { int index = list.locationToIndex(evt.getPoint()); if (isOpen == false) { ap.show(); ap.load(new File("projects/" + Editor.getProjectName() + "/actions/" + list.getModel().getElementAt(index) + ".rbd")); previousSelection = list.getSelectedValue(); isOpen = true; } else { try { if (previousSelection.equals(list.getModel().getElementAt(index))) { ap.hide(); previousSelection = list.getSelectedValue(); list.clearSelection(); isOpen = false; } else { ap.hideThenShow(); previousSelection = list.getSelectedValue(); ap.load(new File("projects/" + Editor.getProjectName() + "/actions/" + list.getModel().getElementAt(index) + ".rbd")); } } catch (NullPointerException npe) { ap.hide(); list.clearSelection(); } } } } }); JScrollPane listPane = new JScrollPane(actionList); listPane.getVerticalScrollBar().setUnitIncrement(Editor.SCROLL_SPEED); this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); this.add(buttons); this.add(listPane); OtherPanel.updateLists(); }
From source file:components.ColorChooserDemo.java
public ColorChooserDemo() { super(new BorderLayout()); //Set up the banner at the top of the window banner = new JLabel("Welcome to the Tutorial Zone!", JLabel.CENTER); banner.setForeground(Color.yellow); banner.setBackground(Color.blue); banner.setOpaque(true);// w w w. j av a 2 s . c o m banner.setFont(new Font("SansSerif", Font.BOLD, 24)); banner.setPreferredSize(new Dimension(100, 65)); JPanel bannerPanel = new JPanel(new BorderLayout()); bannerPanel.add(banner, BorderLayout.CENTER); bannerPanel.setBorder(BorderFactory.createTitledBorder("Banner")); //Set up color chooser for setting text color tcc = new JColorChooser(banner.getForeground()); tcc.getSelectionModel().addChangeListener(this); tcc.setBorder(BorderFactory.createTitledBorder("Choose Text Color")); add(bannerPanel, BorderLayout.CENTER); add(tcc, BorderLayout.PAGE_END); }
From source file:GroupRadio.java
public static Container createRadioButtonGrouping(String elements[], String title, ActionListener actionListener, ItemListener itemListener, ChangeListener changeListener) { JPanel panel = new JPanel(new GridLayout(0, 1)); // If title set, create titled border if (title != null) { Border border = BorderFactory.createTitledBorder(title); panel.setBorder(border);// w w w. j a v a 2 s . co m } // Create group ButtonGroup group = new ButtonGroup(); JRadioButton aRadioButton; // For each String passed in: // Create button, add to panel, and add to group for (int i = 0, n = elements.length; i < n; i++) { aRadioButton = new JRadioButton(elements[i]); panel.add(aRadioButton); group.add(aRadioButton); if (actionListener != null) { aRadioButton.addActionListener(actionListener); } if (itemListener != null) { aRadioButton.addItemListener(itemListener); } if (changeListener != null) { aRadioButton.addChangeListener(changeListener); } } return panel; }
From source file:fuel.gui.stats.MotorStatsPanel.java
public MotorStatsPanel(Database database) throws SQLException { this.database = database; controller = new Controller(); JPanel container = new JPanel(new BorderLayout()); //container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS)); JPanel motorSelectionPanel = new JPanel(); motorSelectionPanel.setLayout(new BoxLayout(motorSelectionPanel, BoxLayout.X_AXIS)); motorSpecsPanel = new JPanel(new GridLayout(2, 3)); motorSpecsPanel.setBorder(BorderFactory.createTitledBorder("Specs")); graphContainer = new JPanel(); graphContainer.setLayout(new BoxLayout(graphContainer, BoxLayout.Y_AXIS)); JComboBox motorSelector = new JComboBox(database.getMotorcycles().toArray()); motorSelector.setActionCommand("SELECTMOTOR"); motorSelector.addActionListener(controller); motorSelectionPanel.add(motorSelector); //motorSelector.setSelectedIndex(0); motorSelectionPanel.add(motorSpecsPanel); refreshMotorSpecs((Motorcycle) motorSelector.getSelectedItem()); container.add(motorSelectionPanel, BorderLayout.NORTH); JScrollPane scroll = new JScrollPane(graphContainer); scroll.getHorizontalScrollBar().setUnitIncrement(10); scroll.getVerticalScrollBar().setUnitIncrement(10); container.add(scroll, BorderLayout.CENTER); refreshGraphs((Motorcycle) motorSelector.getSelectedItem()); setLayout(new BorderLayout()); add(container);// w ww .ja va 2 s . c o m setVisible(true); }