/** * Add name and value labels. * * @param c Component. * @param name Name. * @param val Value. * @param border Border. */ private void addAboutItem(JComponent c, String name, Object val, Border border) { String v = val != null ? val.toString() : "n/a"; String tip = String.format("<html><b>%s</b> ➯ %s</html>", name, val); JLabel lb = new JLabel(name); lb.setToolTipText(tip); JLabel field = new JLabel(v); field.setOpaque(true); field.setBackground(Color.WHITE); field.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(VALUE_BORDER_COLOR, 1), BorderFactory.createEmptyBorder(0, 3, 0, 3))); field.setToolTipText(tip); if (border != null) field.setBorder(border); c.add(lb, gbcLicenseLabel()); c.add(field, gbcLicenseField()); }
private JComponent createQuickOpenPanel(JList<QuickOpenAction> listPanel, String title, List<File> fileList) { listPanel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listPanel.addListSelectionListener(event -> { if (event.getValueIsAdjusting()) { return; } int selectedIndex = listPanel.getSelectedIndex(); if (selectedIndex < 0) { return; } QuickOpenAction action = listPanel.getModel().getElementAt(selectedIndex); action.actionPerformed(new ActionEvent(listPanel, -1, null)); }); refreshQuickOpenPanel(listPanel, fileList); JScrollPane scrollPane = new JScrollPane(listPanel); scrollPane.getVerticalScrollBar().setUnitIncrement(25); scrollPane.setMinimumSize(new Dimension(100, 80)); // Size fits into screen resolution 1024*768 scrollPane.setPreferredSize(new Dimension(180, 200)); JPanel titlePanel = new JPanel(new BorderLayout()); titlePanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); JLabel titleLabel = new JLabel(title); titleLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titlePanel.add(titleLabel, BorderLayout.NORTH); titlePanel.add(scrollPane, BorderLayout.CENTER); return titlePanel; }
private void setBottomPanel() { final JPanel panel = new JPanel(new BorderLayout()); panel.add(new JSeparator(), BorderLayout.NORTH); SizeGrip sg = new SizeGrip(); panel.add(sg, BorderLayout.LINE_END); MouseInputAdapter adapter = new MouseInputAdapter() { private Point lastPoint; JLabel label = new JLabel(FocusableTip.getString("FocusHotkey")); Color fg = UIManager.getColor("Label.disabledForeground"); Font font = textArea.getFont(); label.setForeground(fg); label.setHorizontalAlignment(SwingConstants.TRAILING); label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); panel.add(label); panel.addMouseListener(tipListener); cp.remove(0); JScrollPane sp = new JScrollPane(comp); Border emptyBorder = BorderFactory.createEmptyBorder(); sp.setBorder(emptyBorder); sp.setViewportBorder(emptyBorder);
public AboutDialog(JFrame parent) { this.setResizable(false); this.setSize(new Dimension(400, 250)); this.getContentPane().setLayout(new BorderLayout(0, 0)); JLabel lblResizer = new JLabel(Localization.get("app_name") + " " + Configuration.getVersion()); lblResizer.setBorder(new EmptyBorder(10, 10, 10, 10)); lblResizer.setVerticalTextPosition(SwingConstants.BOTTOM); lblResizer.setIconTextGap(10); lblResizer.setFont(lblResizer.getFont().deriveFont( lblResizer.getFont().getStyle() | Font.BOLD, 16f)); lblResizer.setIcon(new ImageIcon(AboutDialog.class .getResource("/img/icon_64.png"))); this.getContentPane().add(lblResizer, BorderLayout.NORTH); JTextArea txtrResizerIsA = new JTextArea(); txtrResizerIsA.setEditable(false); txtrResizerIsA.setWrapStyleWord(true); txtrResizerIsA.setBorder(new EmptyBorder(0, 10, 10, 10)); txtrResizerIsA.setFont(UIManager.getFont("Label.font")); txtrResizerIsA.setLineWrap(true); txtrResizerIsA.setText(Localization.get("about_text")); txtrResizerIsA.setBackground(new Color(0, 0, 0, 0)); this.getContentPane().add(txtrResizerIsA, BorderLayout.CENTER); this.setLocationRelativeTo(parent); }
public CountryItemEditor() { panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.setBackground(new Color(0, 100,190, 255)); panel.add(labelItem); labelItem.setAlignmentX(Component.LEFT_ALIGNMENT); labelItem.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); labelItem.setBorder(new EmptyBorder(0, 5, 0, 0)); labelItem.setOpaque(false); labelItem.setForeground(Color.WHITE); editValue = null; }
public ProgressPanel() { super(); setBorder(BorderFactory.createTitledBorder("Position")); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); positionLabel.setText("00:00:00/00:00:00"); positionLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); positionSlider.setEnabled(false); positionSlider.setPreferredSize(new Dimension(200, 24)); add(positionSlider); add(positionLabel); }
String name = node.makeLongString(); final JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 0)); panel.setOpaque(false); final JLabel label = new JLabel(name); label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); label.setIcon(node.getIcon()); panel.add(label); panel.add(button); panel.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); return panel;
protected void setLabelAndTextField(Form form, String l, Component field) { JLabel label = new JLabel(l); label.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0)); form.addLabel(label, this); form.addLastField(field, this); }
final JLabel label = new JLabel("Label"); if (row == 0) { if (col == 0) { label.setBorder(BorderFactory.createLineBorder(Color.BLACK)); label.setBorder(BorderFactory.createMatteBorder(borderWidth, 0, borderWidth, if (col == 0) { label.setBorder(BorderFactory.createMatteBorder(0, borderWidth, borderWidth, label.setBorder(BorderFactory.createMatteBorder(0, 0, borderWidth, panel.add(label);
private JComponent initLoading() { setLayout(new BorderLayout()); JLabel loadingLbl = new JLabel(NbBundle.getMessage(CloneableEditor.class, "LBL_EditorLoading")); // NOI18N loadingLbl.setOpaque(true); loadingLbl.setHorizontalAlignment(SwingConstants.CENTER); loadingLbl.setBorder(new EmptyBorder(new Insets(11, 11, 11, 11))); loadingLbl.setVisible(false); add(loadingLbl, BorderLayout.CENTER); return loadingLbl; }
public void stopProgressAnimation() { if (animationTimer != null && animationTimer.isRunning()) { animationTimer.stop(); jLabel.setIcon(findIcon); jLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); } }
}); final JLabel modesLabel = new JLabel("Modes:", SwingConstants.RIGHT); final int leftIndentation = 10; modesLabel.setBorder(BorderFactory.createEmptyBorder(0, leftIndentation, 0, 0)); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(1, 2)); buttonPanel.add(openFileButton); buttonPanel.add(reloadFileButton); final JPanel modesPanel = new JPanel(); modesPanel.add(modesLabel); modesPanel.add(modesCombobox); final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(buttonPanel); mainPanel.add(modesPanel, BorderLayout.LINE_END);
protected void setLabelAndField(Form form, String l, Component field) { JLabel label = new JLabel(l); label.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0)); form.addLabel(label, formPanel); form.addLastField(field, formPanel); }
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); JLabel label = ((JLabel) c); label.setOpaque(false); label.setForeground(Color.white); if (choices.size() <= index) { return label; } Object object = choices.get(index); String name = object.toString(); label.setText(name); if (isSelected) { label.setIcon(new ImageIcon(rightImageHovered)); label.setForeground(SELECTED_COLOR); //label.setBorder(BorderFactory.createLineBorder(BORDER_COLOR)); label.setBorder(BorderFactory.createEmptyBorder()); } else { label.setIcon(new ImageIcon(rightImage)); } return label; }
private JComponent getChooserPanel() { JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); p.setOpaque(false); JLabel l = new JLabel("Please choose installation directory:"); l.setVerticalAlignment(JLabel.NORTH); l.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); p.add(l, BorderLayout.NORTH); table = new JTable(installations); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setColumnSelectionAllowed(false); table.setDefaultRenderer(Object.class, new InstallationTableCellRenderer()); table.getColumnModel().getColumn(0).setHeaderValue("Directory"); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setHeaderValue("Java Version"); table.getColumnModel().getColumn(3).setPreferredWidth(100); table.getColumnModel().getColumn(2).setHeaderValue("Type"); table.getColumnModel().getColumn(3).setPreferredWidth(100); table.getColumnModel().getColumn(3).setHeaderValue("Replaced by DCEVM?"); table.getColumnModel().getColumn(3).setPreferredWidth(200); table.getColumnModel().getColumn(4).setHeaderValue("Installed altjvm?"); table.getColumnModel().getColumn(4).setPreferredWidth(200); JScrollPane lists = new JScrollPane(table); lists.setPreferredSize(new Dimension(900, 200)); p.add(lists, BorderLayout.CENTER); return p; }