本文整理汇总了Java中javax.swing.plaf.metal.MetalBorders类的典型用法代码示例。如果您正苦于以下问题:Java MetalBorders类的具体用法?Java MetalBorders怎么用?Java MetalBorders使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetalBorders类属于javax.swing.plaf.metal包,在下文中一共展示了MetalBorders类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMetalDefaults
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
@Override
protected void addMetalDefaults(LookAndFeelAddons addon,
DefaultsList defaults) {
super.addMetalDefaults(addon, defaults);
String key = "TableHeader.cellBorder";
Border border = UIManager.getBorder(key);
if (border instanceof MetalBorders.TableHeaderBorder) {
border = new BorderUIResource.CompoundBorderUIResource(border,
BorderFactory.createEmptyBorder());
// PENDING JW: this is fishy ... adding to lookAndFeelDefaults is taken
UIManager.getLookAndFeelDefaults().put(key, border);
// adding to defaults is not
// defaults.add(key, border);
}
}
示例2: addInternalPanels
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
void addInternalPanels() {
MetalBorders.Flush3DBorder border = new MetalBorders.Flush3DBorder();
InternalPanel.TODO.setBorder(border);
InternalPanel.COURSES.setBorder(border);
InternalPanel.WORK.setBorder(border);
InternalPanel.WORKLOAD.setBorder(border);
constraints.gridx = 1;
constraints.gridy = 1;
constraints.weighty = 1;
constraints.weightx = 1;
constraints.fill = GridBagConstraints.BOTH;
constraints.gridheight = 4;
constraints.gridwidth = 1;
layout.addLayoutComponent(InternalPanel.TODO, constraints);
layout.addLayoutComponent(InternalPanel.COURSES, constraints);
layout.addLayoutComponent(InternalPanel.WORK, constraints);
layout.addLayoutComponent(InternalPanel.WORKLOAD, constraints);
add(InternalPanel.TODO);
add(InternalPanel.COURSES);
add(InternalPanel.WORK);
add(InternalPanel.WORKLOAD);
InternalPanel.changePanelTo(InternalPanel.TODO);
}
示例3: getComponent
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
private static JComponent getComponent(Border border) {
Class type = border.getClass();
if (type.equals(MotifBorders.MotifPopupMenuBorder.class)) {
return POPUP;
}
if (type.equals(WindowsBorders.ToolBarBorder.class)) {
return TOOLBAR;
}
if (type.equals(MetalBorders.ToolBarBorder.class)) {
return TOOLBAR;
}
return LABEL;
}
示例4: init
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
private void init()
{
listenerList = new EventListenerList();
addMouseListener(new DisplayMouseListener());
addKeyListener(new SimpleKeyListener());
setActionMode(DEFAULT_ACTION_MODE);
background = ColorHelper.getControl();
foreground = ColorHelper.getControlText();
backgroundStart = ColorHelper.getControlShadow();
border = new MetalBorders.Flush3DBorder();
rolloverBackground = ColorHelper.getControl();
rolloverForeground = ColorHelper.getControlText();
rolloverBackgroundStart = ColorHelper.getControlShadow();
rolloverBorder = new MetalBorders.Flush3DBorder();
pressedBackground = ColorHelper.getControlShadow();
pressedForeground = ColorHelper.getControlText();
pressedBackgroundStart = ColorHelper.getControlDarkShadow();
pressedBorder = new PanelFlushBorder(false, true);
fireRate = 20;
setHorizontalAlignment(JLabel.CENTER);
setHorizontalTextPosition(JLabel.CENTER);
setVerticalAlignment(JLabel.CENTER);
setVerticalTextPosition(JLabel.CENTER);
setGradientEnabled(false);
setFocusable(true);
setEnabled(true);
setOpaque(true);
setVisible(true);
setRequestFocusEnabled(true);
}
示例5: hackMetalBorder
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
private void hackMetalBorder(LookAndFeelAddons addon, DefaultsList defaults) {
Border border = UIManager.getBorder("TableHeader.cellBorder");
if (border instanceof MetalBorders.TableHeaderBorder) {
border = new BorderUIResource.CompoundBorderUIResource(border,
BorderFactory.createEmptyBorder());
// too heavyweight ...
// UIManager.put("TableHeader.cellBorder", border);
// LOG.info("updated border " + border);
defaults.add(ColumnHeaderRenderer.METAL_BORDER_HACK, border);
}
}
示例6: TTextArea
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
public TTextArea(Document doc, String text, int rows, int columns){
super(doc,text,rows,columns);
setLineWrap(true);
setWrapStyleWord(true);
Border in = new BasicBorders.MarginBorder();
Border out = new MetalBorders.TextFieldBorder();
setBorder(BorderFactory.createCompoundBorder(out,in));
}
示例7: setUpLoggingPanel
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
/**
* Sets up the logging panel on the left.
*/
private void setUpLoggingPanel() {
logTextArea = new JTextArea();
logTextArea.setEditable(false);
logTextArea.setFont(new Font("Dialog", Font.PLAIN, 12));
logTextArea.setWrapStyleWord(true);
this.logListener = new LimitLinesDocumentListener(ServerConfiguration.getInstance().getLinesToLog());
logTextArea.getDocument().addDocumentListener(this.logListener); // Limits the number of lines
logTextAreaScrollPane = new JScrollPane(logTextArea);
logTextAreaScrollPane.setBorder(BorderFactory.createTitledBorder(new MetalBorders.TextFieldBorder(), "Server Log"));
Logger rootLogger = Logger.getLogger("");
rootLogger.addHandler(new LoggerTextAreaHandler(logTextArea));
}
示例8: setUpGameList
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
/**
* Sets up the game lists (waiting and running) in the lower middle part.
*/
private void setUpGameList() {
listContent = new Vector<Game>();
waitingListContent = new Vector<Game>();
gameList = new JList(listContent);
waitingGameList = new JList(waitingListContent);
gameListScrollPane = new JScrollPane(gameList);
waitingGameListScrollPane = new JScrollPane(waitingGameList);
gameListScrollPane.setBorder(BorderFactory.createTitledBorder(new MetalBorders.TextFieldBorder(), "Active Games"));
waitingGameListScrollPane.setBorder(BorderFactory.createTitledBorder(new MetalBorders.TextFieldBorder(), "Waiting Games"));
gameList.addListSelectionListener(new ServerGUI.GameListSelectionListener(gameNameLabel, versionLabel, participantsList, idLabel, partyLabel, publicGameLabel,statusLabel, endGameButton, false));
waitingGameList.addListSelectionListener(new ServerGUI.GameListSelectionListener(gameNameLabel, versionLabel, participantsList, idLabel, partyLabel, publicGameLabel, statusLabel, endGameButton, true));
}
示例9: setUpAvailableGames
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
/**
* Sets up the list with available (not running) games on top left.
*/
private void setUpAvailableGames()
{
availableGamesContent = new Vector<>();
availableGamesList = new JList(availableGamesContent);
availableGamesListScrollPane = new JScrollPane(availableGamesList);
availableGamesListScrollPane.setBorder(BorderFactory.createTitledBorder(new MetalBorders.TextFieldBorder(), "Available Games"));
}
示例10: setUpActiveUsers
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
/**
* Sets up the list of users (n top right.<br>
* If anonymous login is enbaled, only adHoc created users will be shown in this list.<br>
* Otherwise, all persistent users (logged in or not) and doppelgangers (logged in) will be shown.
*/
private void setUpActiveUsers()
{
activeUsersContent = new Vector<>();
activeUsersList = new JList(activeUsersContent);
activeUsersListScrollPane = new JScrollPane(activeUsersList);
activeUsersListScrollPane.setBorder(BorderFactory.createTitledBorder(new MetalBorders.TextFieldBorder(), "Active Users"));
}
示例11: HTMLLabel
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
public HTMLLabel(){
super();
Border in = new BasicBorders.MarginBorder();
Border out = new MetalBorders.TextFieldBorder();
setBorder(BorderFactory.createCompoundBorder(out,in));
}
示例12: setUpGameInformationPanel
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
/**
* Sets up the game information panel on the right.
*/
private void setUpGameInformationPanel() {
gameInformationPanel = new JPanel(new BorderLayout());
gameInformationPanel.setBorder(BorderFactory.createTitledBorder(new MetalBorders.TextFieldBorder(), "Selected Game"));
JPanel gameInformationButtonPanel = new JPanel(new FlowLayout());
gameInformationPanel.add(gameInformationButtonPanel, BorderLayout.NORTH);
JPanel rightPanelContentPanel = new JPanel();
rightPanelContentPanel.setLayout(null);
idLabel = new JLabel("ID: ");
idLabel.setBounds(new Rectangle(10, 0, 400, 20));
statusLabel = new JLabel("Status: ");
statusLabel.setBounds(10,25,400,20);
gameNameLabel = new JLabel("Game: ");
gameNameLabel.setBounds(new Rectangle(10, 50, 400, 20));
versionLabel = new JLabel("Version: ");
versionLabel.setBounds(new Rectangle(10, 75, 400, 20));
partyLabel = new JLabel("Party name: ");
partyLabel.setBounds(new Rectangle(10, 100, 400, 20));
publicGameLabel = new JLabel("Public party: ");
publicGameLabel.setBounds(new Rectangle(10, 125, 400, 20));
participantsLabel = new JLabel("Participants:");
participantsLabel.setBounds(new Rectangle(10, 150, 400, 20));
participantsList = new JList();
participantsModel = new DefaultListModel();
participantsList.setModel(participantsModel);
particiantsScrollPane = new JScrollPane(participantsList);
particiantsScrollPane.setBounds(10, 170, 190, 165);
endGameButton = new JButton("End game");
endGameButton.setEnabled(false);
endGameButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
GameManager.terminateGame(selectedGame, "Termination requested by administrator.");
}
});
gameInformationButtonPanel.add(endGameButton);
rightPanelContentPanel.add(idLabel);
rightPanelContentPanel.add(statusLabel);
rightPanelContentPanel.add(gameNameLabel);
rightPanelContentPanel.add(versionLabel);
rightPanelContentPanel.add(participantsLabel);
rightPanelContentPanel.add(partyLabel);
rightPanelContentPanel.add(publicGameLabel);
rightPanelContentPanel.add(particiantsScrollPane);
gameInformationPanel.add(rightPanelContentPanel, BorderLayout.CENTER);
}
示例13: testMetalBorderInsets
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
/**
* Issue 337-swingx: header heigth depends on sort icon (for ocean only?)
* Looks like a problem in MetalBorders.TableHeaderBorder: extends AbstractBorder but
* does not override getBorderInsets(comp, insets) which is used by the labelUI getPrefSize
* to determine the insets and calc the view rect.
*
*/
public void testMetalBorderInsets() {
JLabel label = new JLabel("sometext");
AbstractBorder metalBorder = new MetalBorders.TableHeaderBorder();
assertEquals(metalBorder.getBorderInsets(label),
metalBorder.getBorderInsets(label, new Insets(0,0,0,0)));
}
示例14: testMetalBorderInsetsHack
import javax.swing.plaf.metal.MetalBorders; //导入依赖的package包/类
/**
* Issue 337-swingx: header heigth depends on sort icon (for ocean only?)
* Looks like a problem in MetalBorders.TableHeaderBorder: extends AbstractBorder but
* does not override getBorderInsets(comp, insets) which is used by the labelUI getPrefSize
* to determine the insets and calc the view rect.
*
* Here we compound the default metal border
*/
public void testMetalBorderInsetsHack() {
JLabel label = new JLabel("sometext");
AbstractBorder metalBorder = new MetalBorders.TableHeaderBorder();
CompoundBorder compound = new CompoundBorder(metalBorder, BorderFactory.createEmptyBorder());
assertEquals(compound.getBorderInsets(label),
compound.getBorderInsets(label, new Insets(0,0,0,0)));
}