@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); } }
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); }
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; }
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); }
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); } }
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)); }
/** * 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)); }
/** * 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)); }
/** * 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")); }
/** * 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")); }
public HTMLLabel(){ super(); Border in = new BasicBorders.MarginBorder(); Border out = new MetalBorders.TextFieldBorder(); setBorder(BorderFactory.createCompoundBorder(out,in)); }
/** * 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); }
/** * 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))); }
/** * 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))); }