本文整理汇总了Java中javax.swing.BorderFactory类的典型用法代码示例。如果您正苦于以下问题:Java BorderFactory类的具体用法?Java BorderFactory怎么用?Java BorderFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BorderFactory类属于javax.swing包,在下文中一共展示了BorderFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDetails
import javax.swing.BorderFactory; //导入依赖的package包/类
private JComponent createDetails(String text, ActionListener action) {
try {
text = (action == null ? "<html>" : "<html><a href=\"_blank\">") + XMLUtil.toElementContent(text); //NOI18N
} catch (CharConversionException ex) {
throw new IllegalArgumentException(ex);
}
if (null == action) {
return new JLabel(text);
}
JButton btn = new JButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(action);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
if (c != null) {
btn.setForeground(c);
}
return btn;
}
示例2: HelpDialog
import javax.swing.BorderFactory; //导入依赖的package包/类
public HelpDialog() {
setTitle(StringResource.getString("DEFAULT_TITLE"));
setSize(640, 480);
htmlPane = new JEditorPane();
JPanel panel = new JPanel(new BorderLayout(5, 5));
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.add(new JScrollPane(htmlPane));
add(panel);
model = new HelpListModel();
helpList = new JList(values);
JPanel p = new JPanel(new BorderLayout());
p.add(createToolBar(), BorderLayout.NORTH);
p.add(new JScrollPane(helpList));
panel.add(p, BorderLayout.WEST);
setIconImage(XDMIconMap.getIcon("APP_ICON").getImage());
helpList.addListSelectionListener(this);
htmlPane.setEditable(false);
map.put(keys[0], getClass().getResource(
"/help/browser_integration.html"));
map.put(keys[1], getClass().getResource("/help/video_download.html"));
map.put(keys[2], getClass().getResource("/help/refresh_link.html"));
}
示例3: checkDistanceInput
import javax.swing.BorderFactory; //导入依赖的package包/类
/**
* This method checks if the entered distance is
* a number, e.g., and integer greater than 0
*/
private void checkDistanceInput() {
int distance = -1;
distanceInputValid = false;
try {
if (!distanceField.getText().isEmpty())
distance = Integer.parseInt(distanceField.getText());
} catch (NumberFormatException numEx) {
System.out.println("Distance is not a number");
}
if(distance <= 0) {
distanceInputValid = false;
distanceField.setBorder(BorderFactory.createLineBorder(Color.red));
distanceInfo.setText("Invalid distance");
distanceInfo.setForeground(Color.red);
} else {
distanceInputValid = true;
distanceInfo.setText("");
distanceField.setBorder(BorderFactory.createLineBorder(Color.green));
}
checkOkEnabled();
}
示例4: initComponents
import javax.swing.BorderFactory; //导入依赖的package包/类
/**
* Set up the panel contents and layout
*/
protected void initComponents() {
table = new ResultsTable(getTableModel(), help);
statusLabel.setForeground(Color.red);
statusLabel.setFont(new Font("Arial", Font.BOLD, 14));
statusLabel.setText("WARNING: parameters have been changed since this solution was computed!");
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
help.addHelp(statusLabel, "This solution is not current with the parameters of the model. Click solve to compute a new solution.");
JPanel intPanel = new JPanel(new BorderLayout(10, 10));
JScrollPane jsp = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
JLabel descrLabel = new JLabel(getDescriptionMessage());
intPanel.add(descrLabel, BorderLayout.NORTH);
intPanel.add(jsp, BorderLayout.CENTER);
setLayout(new BorderLayout());
add(intPanel, BorderLayout.CENTER);
setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}
示例5: MainToolBar
import javax.swing.BorderFactory; //导入依赖的package包/类
MainToolBar(@NonNull final Pair<JComponent,GridBagConstraints>... components) {
super(BoxLayout.X_AXIS);
setBorder(BorderFactory.createEmptyBorder(1, 2, 1, 5));
final JToolBar toolbar = new NoBorderToolBar(JToolBar.HORIZONTAL);
toolbar.setFloatable(false);
toolbar.setRollover(true);
toolbar.setBorderPainted(false);
toolbar.setBorder(BorderFactory.createEmptyBorder());
toolbar.setOpaque(false);
toolbar.setFocusable(false);
toolbar.setLayout(new GridBagLayout());
for (Pair<JComponent,GridBagConstraints> p : components) {
toolbar.add(p.first(),p.second());
}
add (toolbar);
}
示例6: createTableCSVArea
import javax.swing.BorderFactory; //导入依赖的package包/类
private JPanel createTableCSVArea()
{
JPanel paneCSV = new JPanel();
paneCSV.setLayout(new BoxLayout(paneCSV, BoxLayout.X_AXIS));
paneCSV.setBorder(BorderFactory.createLineBorder(Color.GRAY));
paneCSV.add(m_checkLinkCsv);
paneCSV.add(m_txtLinkCsvPath);
m_txtLinkCsvPath.setEditable(false);
paneCSV.setBounds(m_scrollTblName.getWidth() + GuiConstants.GAP_COMPONENT, m_nYOffsetInRightPane,
s_nRightPaneWidth, s_nOneRowPaneHeight);
m_nYOffsetInRightPane += (s_nOneRowPaneHeight + GuiConstants.GAP_COMPONENT);
return paneCSV;
}
示例7: createConnOptions
import javax.swing.BorderFactory; //导入依赖的package包/类
public JPanel createConnOptions() {
JPanel optsPanelCon = new VerticalPanel();
optsPanelCon.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Connection options"));
JPanel optsPanel0 = new HorizontalPanel();
optsPanel0.add(connNamePrefix);
optsPanel0.add(connNameSuffix);
connNameSuffix.setSelected(true);
optsPanelCon.add(optsPanel0);
JPanel optsPanel1 = new HorizontalPanel();
optsPanel1.add(connKeepAlive);
optsPanel1.add(connKeeptime);
optsPanelCon.add(optsPanel1);
optsPanel1.add(connAttmptMax);
optsPanel1.add(reconnAttmptMax);
optsPanelCon.add(optsPanel1);
return optsPanelCon;
}
示例8: GoalsPanel
import javax.swing.BorderFactory; //导入依赖的package包/类
/** Creates new form POMInheritancePanel */
@Messages("HINT_Panel_hide=Click or press {0} to hide/show when the Navigator is active")
public GoalsPanel() {
initComponents();
treeView = (BeanTreeView)jScrollPane1;
preferences = NbPreferences.forModule(GoalsPanel.class).node("goalNavigator");
filtersPanel = new TapPanel();
filtersPanel.setOrientation(TapPanel.DOWN);
// tooltip
KeyStroke toggleKey = KeyStroke.getKeyStroke(KeyEvent.VK_T,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
String keyText = Utilities.keyToString(toggleKey);
filtersPanel.setToolTipText(HINT_Panel_hide(keyText)); //NOI18N
JComponent buttons = createFilterButtons();
buttons.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0));
filtersPanel.add(buttons);
if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) {
filtersPanel.setBackground(UIManager.getColor("NbExplorerView.background"));//NOI18N
}
add(filtersPanel, BorderLayout.SOUTH);
}
示例9: TablePanel
import javax.swing.BorderFactory; //导入依赖的package包/类
public TablePanel(Table aTable) {
table = aTable;
innerPanel = new JPanel();
add(innerPanel);
// Adding the panel's border padding
setLayout(new FlowLayout(FlowLayout.LEFT));
innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
innerPanel.setBorder(BorderFactory.createEmptyBorder(NEW_TABLE_PANEL_TOP_PADDING,
NEW_TABLE_PANEL_LEFT_PADDING,
NEW_TABLE_PANEL_BOTTOM_PADDING,
NEW_TABLE_PANEL_RIGHT_PADDING));
// Fill the panel with the attributes info
addAttributes();
// Common settings
setBackground(BACKGROUND_COLOR);
innerPanel.setBackground(BACKGROUND_COLOR);
}
示例10: createNiceMessages
import javax.swing.BorderFactory; //导入依赖的package包/类
private JComponent createNiceMessages()
{
JLabel heading = new JLabel("<html><font size=+1>" + title + "</font></html>");
JTextArea body = new JTextArea(message);
body.setHighlighter(null);
body.setEditable(false);
body.setFocusable(false);
body.setOpaque(false);
body.setBorder(null);
body.setLineWrap(true);
body.setWrapStyleWord(true);
body.setFont(heading.getFont());
final int[] rows = new int[]{heading.getPreferredSize().height, TableLayout.FILL};
final int[] columns = new int[]{TableLayout.FILL};
TableLayout layout = new TableLayout(rows, columns, 5, 5);
JPanel all = new JPanel(layout);
all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
all.add(heading, new Rectangle(0, 0, 1, 1));
all.add(body, new Rectangle(0, 1, 1, 1));
return all;
}
示例11: getTableCellRendererComponent
import javax.swing.BorderFactory; //导入依赖的package包/类
public Component getTableCellRendererComponent(JTable table, Object color, boolean isSelected, boolean hasFocus, int row, int column) {
Color newColor = (Color)color;
setBackground(newColor);
if (isBordered) {
if (isSelected) {
if (selectedBorder == null) {
selectedBorder = BorderFactory.createMatteBorder(2, 5, 2, 5, table.getSelectionBackground());
}
setBorder(selectedBorder);
} else {
if (unselectedBorder == null) {
unselectedBorder = BorderFactory.createMatteBorder(2, 5, 2, 5, table.getBackground());
}
setBorder(unselectedBorder);
}
}
if(newColor!=null){
setToolTipText("RGB value: " + newColor.getRed() + ", " + newColor.getGreen() + ", " + newColor.getBlue());
}
return this;
}
示例12: LDADemo
import javax.swing.BorderFactory; //导入依赖的package包/类
/**
* Constructor.
*/
public LDADemo() {
startButton = new JButton("Start");
startButton.setActionCommand("startButton");
startButton.addActionListener(this);
datasetBox = new JComboBox<>();
for (int i = 0; i < datasetName.length; i++) {
datasetBox.addItem(datasetName[i]);
}
datasetBox.setSelectedIndex(0);
datasetBox.setActionCommand("datasetBox");
datasetBox.addActionListener(this);
optionPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
optionPane.setBorder(BorderFactory.createRaisedBevelBorder());
optionPane.add(startButton);
optionPane.add(new JLabel("Dataset:"));
optionPane.add(datasetBox);
setLayout(new BorderLayout());
add(optionPane, BorderLayout.NORTH);
}
示例13: getListCellRendererComponent
import javax.swing.BorderFactory; //导入依赖的package包/类
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
JLabel renderer = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
renderer.setBorder(BorderFactory.createEmptyBorder(1, 7, 1, 5));
if (value instanceof ProfilingPoint) {
boolean enabled = ((ProfilingPoint) value).isEnabled();
renderer.setText(((ProfilingPoint) value).getName());
renderer.setIcon(enabled ? ((ProfilingPoint) value).getFactory().getIcon() :
((ProfilingPoint) value).getFactory().getDisabledIcon());
renderer.setEnabled(enabled);
} else if (value instanceof ProfilingPointFactory) {
renderer.setText(((ProfilingPointFactory) value).getType());
renderer.setIcon(((ProfilingPointFactory) value).getIcon());
renderer.setEnabled(true);
} else {
renderer.setIcon(null);
renderer.setEnabled(true);
}
return renderer;
}
示例14: ResultPanelTree
import javax.swing.BorderFactory; //导入依赖的package包/类
ResultPanelTree(ResultDisplayHandler displayHandler, StatisticsPanel statPanel) {
super(new BorderLayout());
treeView = new ResultTreeView();
treeView.getAccessibleContext().setAccessibleName(Bundle.ACSN_TestResults());
treeView.getAccessibleContext().setAccessibleDescription(Bundle.ACSD_TestResults());
treeView.setBorder(BorderFactory.createEtchedBorder());
// resultBar.setPassedPercentage(0.0f);
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.add(resultBar);
toolBar.setBorder(BorderFactory.createEtchedBorder());
add(toolBar, BorderLayout.NORTH);
add(treeView, BorderLayout.CENTER);
explorerManager = new ExplorerManager();
explorerManager.setRootContext(rootNode = new RootNode(displayHandler.getSession(), filterMask));
explorerManager.addPropertyChangeListener(this);
initAccessibility();
this.displayHandler = displayHandler;
this.statPanel = statPanel;
displayHandler.setLookup(ExplorerUtils.createLookup(explorerManager, new ActionMap()));
}
示例15: FontChooser
import javax.swing.BorderFactory; //导入依赖的package包/类
/**
* Constructs a <code>FontChooser</code> object using the given font size array.
* @param fontSizeStrings the array of font size string.
**/
public FontChooser(String[] fontSizeStrings) {
if (fontSizeStrings == null) {
fontSizeStrings = DEFAULT_FONT_SIZE_STRINGS;
}
this.fontSizeStrings = fontSizeStrings;
JPanel selectPanel = new JPanel();
selectPanel.setLayout(new BoxLayout(selectPanel, BoxLayout.X_AXIS));
selectPanel.add(getFontFamilyPanel());
selectPanel.add(getFontStylePanel());
selectPanel.add(getFontSizePanel());
JPanel contentsPanel = new JPanel();
contentsPanel.setLayout(new GridLayout(2, 1));
contentsPanel.add(selectPanel, BorderLayout.NORTH);
contentsPanel.add(getSamplePanel(), BorderLayout.CENTER);
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
this.add(contentsPanel);
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.setSelectedFont(DEFAULT_SELECTED_FONT);
}