本文整理了Java中javax.swing.JLabel.setBorder()
方法的一些代码示例,展示了JLabel.setBorder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.setBorder()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:setBorder
暂无
代码示例来源:origin: jersey/jersey
@Override
public void run() {
label.setBackground(PROGRESS_COLOR);
label.setToolTipText("Running...");
label.setBorder(javax.swing.BorderFactory.createLineBorder(new Color(0, 0, 0)));
label.setOpaque(true);
messagePanel.add(label);
messagePanel.revalidate();
}
});
代码示例来源:origin: apache/ignite
/**
* 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());
}
代码示例来源:origin: kiegroup/optaplanner
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;
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
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);
代码示例来源:origin: stackoverflow.com
JPanel panel = new JPanel(new GridLayout(10,10));
panel.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
for (int i =0; i<(10*10); i++){
final JLabel label = new JLabel("Label");
label.setBorder(BorderFactory.createLineBorder(Color.BLACK));
panel.add(label);
}
代码示例来源:origin: 4thline/cling
@Override
public void setPresenter(Presenter presenter) {
this.presenter = presenter;
removeAll();
JLabel welcomeLabel = new JLabel("Please select an item.");
welcomeLabel.setBorder(new EmptyBorder(20, 20, 20, 20));
add(welcomeLabel, BorderLayout.CENTER);
revalidate();
repaint();
}
代码示例来源:origin: redwarp/9-Patch-Resizer
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);
}
代码示例来源:origin: magefree/mage
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;
}
代码示例来源:origin: 4thline/cling
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);
}
代码示例来源:origin: skylot/jadx
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;
代码示例来源:origin: 4thline/cling
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);
}
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: alibaba/druid
scrollPane.setRowHeaderView(header);
scrollPane.setViewportView(table);
JLabel jb = new JLabel("N", SwingConstants.CENTER);
jb.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, jb);
代码示例来源:origin: org.netbeans.api/org-openide-text
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;
}
代码示例来源:origin: org.netbeans.api/org-openide-awt
public void stopProgressAnimation() {
if (animationTimer != null && animationTimer.isRunning()) {
animationTimer.stop();
jLabel.setIcon(findIcon);
jLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
}
}
代码示例来源:origin: checkstyle/checkstyle
});
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);
代码示例来源:origin: 4thline/cling
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);
}
代码示例来源:origin: runelite/runelite
JLabel groupLabel = new JLabel(patch.getImplementation().getName());
groupLabel.setBorder(new EmptyBorder(4, 0, 0, 0));
groupLabel.setBorder(new EmptyBorder(15, 0, 0, 0));
代码示例来源:origin: magefree/mage
@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;
}
代码示例来源:origin: dcevm/dcevm
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;
}
内容来源于网络,如有侵权,请联系作者删除!