本文整理了Java中javax.swing.JPanel.setBorder()
方法的一些代码示例,展示了JPanel.setBorder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.setBorder()
方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:setBorder
暂无
代码示例来源:origin: log4j/log4j
protected JPanel createStatusArea() {
JPanel statusArea = new JPanel();
JLabel status =
new JLabel("No log records to display.");
_statusLabel = status;
status.setHorizontalAlignment(JLabel.LEFT);
statusArea.setBorder(BorderFactory.createEtchedBorder());
statusArea.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
statusArea.add(status);
return (statusArea);
}
代码示例来源:origin: stackoverflow.com
JPanel p =new JPanel();
p.setBorder(new EmptyBorder(10, 10, 10, 10));
代码示例来源:origin: libgdx/libgdx
void addEditorRow (JPanel row) {
row.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, java.awt.Color.black));
editRowsPanel.add(row, new GridBagConstraints(0, -1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0));
}
代码示例来源:origin: chewiebug/GCViewer
public void newGroup(String name, boolean withBorder) {
currentPanel = new JPanel();
if (withBorder) {
currentPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder(name),
BorderFactory.createEmptyBorder(0,0,0,0)));
}
// using GridBagLayout because it allows for 2 columns with different widths
currentLayout = new GridBagLayout();
currentConstraints = new GridBagConstraints();
currentConstraints.anchor = GridBagConstraints.WEST;
currentConstraints.fill = GridBagConstraints.HORIZONTAL;
currentConstraints.weightx = 1.0;
currentConstraints.weighty = 1.0;
currentConstraints.insets = new Insets(0, 3, 0, 3);
currentConstraints.gridy = -1;
currentPanel.setLayout(currentLayout);
add(currentPanel);
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
frame.setLayout(new BorderLayout());
frame.setSize(200, 200);
// create the status bar panel and shove it down the bottom of the frame
JPanel statusPanel = new JPanel();
statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
frame.add(statusPanel, BorderLayout.SOUTH);
statusPanel.setPreferredSize(new Dimension(frame.getWidth(), 16));
statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS));
JLabel statusLabel = new JLabel("status");
statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
statusPanel.add(statusLabel);
frame.setVisible(true);
代码示例来源:origin: libgdx/libgdx
void addRow(JPanel panel, JPanel row, float wx, float wy) {
row.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, java.awt.Color.black));
panel.add(row, new GridBagConstraints(0, -1, 1, 1, wx, wy, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0));
}
代码示例来源:origin: wiztools/rest-client
public static JPanel getFlowLayoutPanelLeftAligned(String title, Component component){
JPanel jp = new JPanel();
jp.setLayout(new FlowLayout(FlowLayout.LEFT));
if(title != null){
if(component instanceof JPanel){
JPanel p = (JPanel)component;
p.setBorder(BorderFactory.createTitledBorder(title));
}
}
jp.add(component);
return jp;
}
代码示例来源:origin: libgdx/libgdx
void addRow(JPanel panel, JPanel row, float wx, float wy) {
row.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, java.awt.Color.black));
panel.add(row, new GridBagConstraints(0, -1, 1, 1, wx, wy, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0));
}
代码示例来源:origin: stackoverflow.com
JPanel panel = new JPanel();
panel.add(new JLabel("foo"));
panel.setBorder(BorderFactory.createTitledBorder("bar"));
代码示例来源:origin: libgdx/libgdx
void addRow (JPanel row) {
row.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, java.awt.Color.black));
rowsPanel.add(row, new GridBagConstraints(0, -1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0));
}
代码示例来源:origin: deathmarine/Luyten
protected JPanel getSamplePanel() {
if (samplePanel == null) {
Border titledBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), ("Sample"));
Border empty = BorderFactory.createEmptyBorder(5, 10, 10, 10);
Border border = BorderFactory.createCompoundBorder(titledBorder, empty);
samplePanel = new JPanel();
samplePanel.setLayout(new BorderLayout());
samplePanel.setBorder(border);
samplePanel.add(getSampleTextField(), BorderLayout.CENTER);
}
return samplePanel;
}
代码示例来源:origin: libgdx/libgdx
void addEditorRow (JPanel row) {
row.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, java.awt.Color.black));
editRowsPanel.add(row, new GridBagConstraints(0, -1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0));
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createTableHeader(JLabel label) {
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(label, BorderLayout.NORTH);
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
return headerPanel;
}
代码示例来源:origin: libgdx/libgdx
void addRow (JPanel row) {
row.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, java.awt.Color.black));
rowsPanel.add(row, new GridBagConstraints(0, -1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 0, 0));
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createTableHeader(JLabel label) {
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(label, BorderLayout.NORTH);
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
return headerPanel;
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createTableHeader(JLabel label) {
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(label, BorderLayout.NORTH);
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
return headerPanel;
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createTableHeader(JLabel label) {
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(label, BorderLayout.NORTH);
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
return headerPanel;
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createTableHeader(JLabel label) {
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(label, BorderLayout.NORTH);
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
return headerPanel;
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createHeaderPanel(JLabel label) {
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(label, BorderLayout.NORTH);
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
return headerPanel;
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createTableHeader(JLabel label, String toolTip) {
if (toolTip != null) {
label.setToolTipText(toolTip);
}
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(label, BorderLayout.NORTH);
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
return headerPanel;
}
内容来源于网络,如有侵权,请联系作者删除!