本文整理汇总了Java中javax.swing.border.EmptyBorder类的典型用法代码示例。如果您正苦于以下问题:Java EmptyBorder类的具体用法?Java EmptyBorder怎么用?Java EmptyBorder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmptyBorder类属于javax.swing.border包,在下文中一共展示了EmptyBorder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AvengersFrame
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
/**
* Create the frame.
*/
public AvengersFrame() throws Exception {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 1200, 800);
heroPanel = new HeroInfo();
heroPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
//heroPanel.setLayout(new BorderLayout(0, 0));
setContentPane(heroPanel);
HeroService service = new HeroService();
heroPanel.addHero(service.findHeroesByName("Captain America"));
heroPanel.getBtnSearch().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
HeroInfo pan = new HeroInfo();
pan.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(pan);
//pan.addHero(service.findHeroesByName(heroPanel.getTextField_1().toString()));
}
});
}
示例2: Busqueda
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
public Busqueda(Connection conn, JFrameJTable principal, String sql, char QuienEs) {
setIconImage(Toolkit.getDefaultToolkit().getImage(Busqueda.class.getResource("/biblioteca/images/book.png")));
this.QuienEs=QuienEs;
this.conn=conn;
this.principal=principal;
this.principal.setEnabled(false);
setTitle("B�squeda");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 492, 370);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
txtUsuario = new JTextField();
txtUsuario.setBounds(10, 33, 328, 23);
contentPane.add(txtUsuario);
txtUsuario.setColumns(10);
txtUsuario.addKeyListener(this);
btnBuscar = new JButton("Buscar");
btnBuscar.setBounds(357, 32, 109, 23);
contentPane.add(btnBuscar);
btnBuscar.addActionListener(this);
table = new PanelJtable(conn,sql,this);
table.setBounds(10, 78, 456, 242);
contentPane.add(table);
addWindowListener(this);
setVisible(true);
setLocationRelativeTo(null);
}
示例3: initComponents
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
private void initComponents() {
setLayout(new BorderLayout(5, 5));
this.setBorder(new EmptyBorder(20, 20, 20, 20));
//classesList = new JList(new StationsListModel());
stationsList = new JList();
stationsList.setListData(stationData.getStationKeys());
stationsList.setCellRenderer(new StationElementRenderer());
stationsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
panelDescription = new JLabel(STATIONS_PAR_DESCRIPTION);
JScrollPane jsp = new JScrollPane(stationsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jsp.setPreferredSize(new Dimension(140, 200));
add(panelDescription, BorderLayout.NORTH);
add(jsp, BorderLayout.WEST);
stationsList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
updateParsPane();
}
});
}
示例4: layoutGuiComponents
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
private void layoutGuiComponents() {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
setBorder(new EmptyBorder(25, 25, 25, 25));
importFileValue = new PlainFontLabel();
JPanel labelPanel = new FixedHeightPanel();
labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.X_AXIS));
labelPanel.add(new JLabel("File:"));
labelPanel.add(Box.createHorizontalStrut(12));
labelPanel.add(importFileValue);
labelPanel.add(Box.createHorizontalGlue());
displayArea = new JTextArea();
displayArea.setEditable(false);
displayArea.setForeground(Color.GRAY);
JScrollPane scrollPane = new JScrollPane(displayArea);
//
// top level panel
//
add(labelPanel);
add(Box.createVerticalStrut(17));
add(scrollPane);
}
示例5: createToggleButton
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
private static JToggleButton createToggleButton (final String id, String iconPath, String tooltip) {
Icon icon = ImageUtilities.loadImageIcon(iconPath, false);
boolean isSelected = isButtonSelected(id);
final JToggleButton toggleButton = new JToggleButton(icon, isSelected);
// ensure small size, just for the icon
Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
toggleButton.setPreferredSize(size);
toggleButton.setMargin(new Insets(1, 1, 1, 1));
if (!"Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
// We do not want an ugly border with the exception of Mac, where it paints the toggle state!
toggleButton.setBorder(new EmptyBorder(toggleButton.getBorder().getBorderInsets(toggleButton)));
}
toggleButton.setToolTipText(tooltip);
toggleButton.setFocusable(false);
return toggleButton;
}
示例6: jbInit
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
void jbInit() throws Exception {
border1 =
BorderFactory.createCompoundBorder(
BorderFactory.createEtchedBorder(
Color.white,
new Color(156, 156, 158)),
BorderFactory.createEmptyBorder(5, 5, 5, 5));
border2 = BorderFactory.createEmptyBorder(5, 0, 5, 0);
panel1.setLayout(borderLayout1);
this.getContentPane().setLayout(borderLayout2);
bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
topPanel.setBorder(new EmptyBorder(new Insets(0, 5, 0, 5)));
topPanel.setBackground(Color.WHITE);
jPanel1.setLayout(borderLayout3);
panel1.setBorder(border1);
jPanel1.setBorder(border2);
getContentPane().add(panel1, BorderLayout.CENTER);
panel1.add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(stickerText, null);
panel1.add(jPanel1, BorderLayout.SOUTH);
this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
this.getContentPane().add(topPanel, BorderLayout.NORTH);
stickerText.setText(txt);
stickerText.setOpaque(true);
stickerText.setBackground(backGroundColor);
stickerText.setForeground(foreGroundColor);
}
示例7: setFilterVisible
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
private void setFilterVisible(boolean visible) {
northWestPanel.removeAll();
if(visible) {
//update the UI
northWestPanel.add(filterTextField, BorderLayout.CENTER);
cancelFilterLabel.setBorder(new EmptyBorder(0,4,0,0));
if(addPropertyMode) {
northWestPanel.add(cancelFilterLabel, BorderLayout.WEST);
}
//set the filter text to the node
node.setFilterText(filterTextField.getText());
filterTextField.requestFocus();
} else {
//update the UI
northWestPanel.add(titleLabel);
//just remove the filter text from the node, but keep it in the field
//so next time it is opened it will contain the old value
node.setFilterText(null);
}
northWestPanel.revalidate();
northWestPanel.repaint();
}
示例8: NewDatabaseDialog
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
public NewDatabaseDialog() {
newDatabaseNameField = new JTextField();
nextButton = new JButton("NEXT");
newDatabaseNameField.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
setLayout(new BorderLayout());
EmptyBorder padding = new EmptyBorder(5, 5, 5, 5);
JPanel textFieldPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
textFieldPanel.setBorder(padding);
buttonsPanel.setBorder(padding);
textFieldPanel.add(new JLabel("DB name: "));
textFieldPanel.add(newDatabaseNameField);
buttonsPanel.add(nextButton);
add(textFieldPanel, BorderLayout.NORTH);
add(buttonsPanel, BorderLayout.SOUTH);
buildWindow();
}
示例9: addTextArea
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
private void addTextArea(int x, int y) {
int left = getCanvas().getBounds().x + x;
int top = getCanvas().getBounds().y + y;
textArea.setVisible(true);
textArea.setBorder(new EmptyBorder(0, 0, 0, 0));
textArea.setText("");
textArea.setBounds(left, top, (int)(getCanvas().getBounds().getWidth() * getCanvas().getScale()) - left, (int)(getCanvas().getBounds().getHeight() * getCanvas().getScale()) - top);
textArea.setFont(getScaledFont());
textArea.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
TextTool.this.mousePressed(e, new Point(0, 0));
}
});
getCanvas().addComponent(textArea);
textArea.requestFocus();
}
示例10: updateFor
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
public static boolean updateFor (String url) {
boolean retval = false;
final RemoteRepository repository = new RemoteRepository(null, url, true);
JPanel panel = repository.getPanel();
panel.setBorder(new EmptyBorder(10, 10, 10, 10));
final DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(RemoteRepositoryPanel.class, "ACSD_RepositoryPanel_Title"), //NOI18N
true, new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION }, DialogDescriptor.OK_OPTION,
DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(RemoteRepository.class), null);
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
repository.addChangeListener(new ChangeListener() {
@Override
public void stateChanged (ChangeEvent e) {
dd.setValid(repository.isValid());
}
});
if (repository.isValid()) {
dd.setValid(true);
}
dialog.setVisible(true);
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
repository.activeSettingsType.store();
retval = true;
}
return retval;
}
示例11: showCustomizer
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
/**
* Shows libraries customizer for given library manager.
* @param activeLibrary if not null the activeLibrary is selected in the opened customizer
* @return true if user pressed OK and libraries were sucessfully modified
*/
@Messages("TXT_LibrariesManager=Ant Library Manager")
public static boolean showCustomizer (Library activeLibrary, LibraryManager libraryManager) {
org.netbeans.modules.project.libraries.ui.LibrariesCustomizer customizer =
new org.netbeans.modules.project.libraries.ui.LibrariesCustomizer (
LibrariesSupport.getLibraryStorageArea(libraryManager));
customizer.setBorder(new EmptyBorder(12, 12, 0, 12));
if (activeLibrary != null) {
customizer.setSelectedLibrary (LibrariesSupport.getLibraryImplementation(activeLibrary));
}
DialogDescriptor descriptor = new DialogDescriptor(customizer, TXT_LibrariesManager());
Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
setAccessibleDescription(dlg, customizer.getAccessibleContext().getAccessibleDescription());
try {
dlg.setVisible(true);
if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
return customizer.apply();
} else {
return false;
}
} finally {
dlg.dispose();
}
}
示例12: customizeLibrary
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
@Messages("LibrariesCustomizer.customizeLibrary.title=Customize Library")
private static boolean customizeLibrary(org.netbeans.modules.project.libraries.ui.LibrariesCustomizer customizer,
LibraryImplementation activeLibrary) {
customizer.hideLibrariesList();
customizer.setBorder(new EmptyBorder(12, 8, 0, 10));
customizer.setSelectedLibrary (activeLibrary);
DialogDescriptor descriptor = new DialogDescriptor(customizer, LibrariesCustomizer_customizeLibrary_title());
Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
setAccessibleDescription(dlg, customizer.getAccessibleContext().getAccessibleDescription());
try {
dlg.setVisible(true);
if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
customizer.apply();
return true;
} else {
return false;
}
} finally {
dlg.dispose();
}
}
示例13: getMessageScrollPane
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
private static JScrollPane getMessageScrollPane(String message) {
JTextArea ta = new JTextArea(message);
ta.setBorder(new EmptyBorder(0, 0, 0, 0));
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
ta.setCaretPosition(0);
ta.setEditable(false);
JScrollPane sp = new JScrollPane(ta);
sp.setBorder(new EmptyBorder(5, 5, 5, 5));
if (message.length() < 100) {
sp.setPreferredSize(new Dimension(400, 50));
} else {
sp.setPreferredSize(new Dimension(400, 100));
}
return sp;
}
示例14: createLinkLabel
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
/**
* Creates a link label. A link label is a form of a JButton but without a
* button like appearance.
*/
private void createLinkLabel() {
setBorder(new EmptyBorder(1,1,1,1));
setBorderPainted(false);
setFocusPainted(false);
setAlignmentY(getPreferredAlignmentY());
setContentAreaFilled(false);
setHorizontalAlignment(SwingConstants.LEFT);
setBackground(UIManager.getColor("EditorPane.background"));
if (textAttribs != null &&
textAttribs.isDefined(StyleConstants.Foreground)) {
setForeground((Color)textAttribs.getAttribute(StyleConstants.Foreground));
} else {
setForeground(Color.blue);
}
invalidate();
}
示例15: About
import javax.swing.border.EmptyBorder; //导入依赖的package包/类
/**
* Create the frame.
*/
public About() {
setTitle("About - BassNES");
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setBounds(100, 100, 290, 228);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("BassNES");
lblNewLabel.setFont(new Font("Times New Roman", Font.BOLD, 24));
lblNewLabel.setBounds(25, 11, 128, 43);
contentPane.add(lblNewLabel);
JLabel lblNewLabel_1 = new JLabel("Version: "+ UISettings.version);
lblNewLabel_1.setBounds(25, 51, 115, 14);
contentPane.add(lblNewLabel_1);
JLabel lblNewLabel_2 = new JLabel("�2017 J. Howe (aka TheBassist95)");
lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
lblNewLabel_2.setBounds(10, 65, 254, 23);
contentPane.add(lblNewLabel_2);
}