JPanel p =new JPanel(); p.setBorder(new EmptyBorder(10, 10, 10, 10));
private JPanel buildPingField() { JPanel column = new JPanel(new BorderLayout()); column.setBorder(new EmptyBorder(0, 5, 0, 5)); pingField = new JLabel("-"); pingField.setFont(FontManager.getRunescapeSmallFont()); column.add(pingField, BorderLayout.EAST); return column; }
private JPanel createInfoPanel(String text) { JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(new EmptyBorder(7, 8, 6, 8)); panel.setBackground(ColorScheme.DARK_GRAY_COLOR); JLabel infoLabel = new JShadowedLabel(text); infoLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker()); infoLabel.setFont(FontManager.getRunescapeSmallFont()); panel.add(infoLabel); return panel; }
JLabel l = new JLabel(text, alignment); l.setBorder(new LineBorder(Color.RED, 2)); return l; SwingUtilities.invokeLater(new Runnable() { public void run() { JPanel p = new JPanel(new GridLayout(2,2,4,4)); p.setBackground(Color.black); p.setBorder(new EmptyBorder(4,4,4,4)); JPanel border = new JPanel(new BorderLayout()); border.add(getLabel( "Border", SwingConstants.CENTER), BorderLayout.CENTER); p.add(border); JPanel gridbag = new JPanel(new GridBagLayout()); gridbag.add(getLabel("GridBag")); p.add(gridbag); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(p); f.pack(); f.setLocationByPlatform(true); f.setVisible(true);
private JPanel makeSkillPanel(HiscoreSkill skill) { JLabel label = new JLabel(); label.setFont(FontManager.getRunescapeSmallFont()); label.setText("--"); String skillName = (skill == null ? "combat" : skill.getName().toLowerCase()); String directory = "/skill_icons"; if (skillName.equals("combat") || skillName.equals("overall")) { // Cannot use SpriteManager as HiscorePlugin loads before a Client is available directory += "/"; } else { directory += "_small/"; } String skillIcon = directory + skillName + ".png"; log.debug("Loading skill icon from {}", skillIcon); label.setIcon(new ImageIcon(ImageUtil.getResourceStreamFromClass(getClass(), skillIcon))); boolean totalLabel = skill == HiscoreSkill.OVERALL || skill == null; //overall or combat label.setIconTextGap(totalLabel ? 10 : 4); JPanel skillPanel = new JPanel(); skillPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); skillPanel.setBorder(new EmptyBorder(2, 0, 2, 0)); skillLabels.add(label); skillPanel.add(skillLabels.get(skillLabels.size() - 1)); return skillPanel; }
private static void createAndShowGUI(JPanel jtop) { JFrame frame = new JFrame("GfxdTop"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent contentPane = (JComponent) frame.getContentPane(); contentPane.add(jtop, BorderLayout.CENTER); contentPane.setOpaque(true); contentPane.setBorder(new EmptyBorder(12, 12, 12, 12)); frame.setContentPane(contentPane); frame.pack(); frame.setVisible(true); }
mainLayout = new BorderLayout(0,0); gui = new JPanel(mainLayout); gui.setBackground(Color.RED); border = new EmptyBorder(0,0,0,0); tree.expandRow(ii); JPanel buttonPanel = new JPanel(buttonLayout); gui.add(buttonPanel, BorderLayout.PAGE_START); buttonPanel.add(new JLabel("H Gap")); final JSpinner hSpinner = mainLayout.setVgap(vGap); buttonLayout.setHgap(hGap); gui.setBorder(new EmptyBorder(vBorder,hBorder,vBorder,hBorder)); Container c = gui.getTopLevelAncestor(); if (c instanceof Window) { Window w = (Window)c; w.pack(); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.pack(); f.setVisible(true);
/** * Builds the activity list field (containing that world's activity/theme). */ private JPanel buildActivityField() { JPanel column = new JPanel(new BorderLayout()); column.setBorder(new EmptyBorder(0, 5, 0, 5)); activityField = new JLabel(world.getActivity()); activityField.setFont(FontManager.getRunescapeSmallFont()); column.add(activityField, BorderLayout.WEST); return column; }
GrandExchangeOffersPanel() { setLayout(new BorderLayout()); setBackground(ColorScheme.DARK_GRAY_COLOR); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1; constraints.gridx = 0; constraints.gridy = 0; /* This panel wraps the offers panel and limits its height */ JPanel offersWrapper = new JPanel(new BorderLayout()); offersWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR); offersWrapper.add(offerPanel, BorderLayout.NORTH); offerPanel.setLayout(new GridBagLayout()); offerPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); offerPanel.setBackground(ColorScheme.DARK_GRAY_COLOR); /* This panel wraps the error panel and limits its height */ JPanel errorWrapper = new JPanel(new BorderLayout()); errorWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR); /* The error panel, this displays an error message */ PluginErrorPanel errorPanel = new PluginErrorPanel(); errorWrapper.add(errorPanel, BorderLayout.NORTH); errorPanel.setBorder(new EmptyBorder(50, 20, 20, 20)); errorPanel.setContent("No offers detected", "No grand exchange offers were found on your account."); container.add(offersWrapper, OFFERS_PANEL); container.add(errorWrapper, ERROR_PANEL); add(container, BorderLayout.CENTER); resetOffers(); }
@Override public void run () { JPanel panel = new JPanel(new FlowLayout()); JPanel textPanel = new JPanel() { public boolean isOptimizedDrawingEnabled () { return false; textPanel.add(textField); final JLabel placeholderLabel = new JLabel(hint); placeholderLabel.setForeground(Color.GRAY); placeholderLabel.setAlignmentX(0.0f); placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));
private static void createAndShowGUI(TxPerfGraph perfPanel) { JFrame frame = perfPanel.getFrame(); // Create and set up the window. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Create and set up the content pane. JComponent contentPane = (JComponent) frame.getContentPane(); contentPane.add(perfPanel, BorderLayout.CENTER); contentPane.setOpaque(true); //content panes must be opaque contentPane.setBorder(new EmptyBorder(12, 12, 12, 12)); frame.setContentPane(contentPane); // Display the window. frame.pack(); frame.setVisible(true); }
private final JLabel sizeLabel = new JLabel(); private final JLabel textLabel = new JLabel(text); private final MyLabelUI myUI = new MyLabelUI(); this.setBorder(BorderFactory.createCompoundBorder( new LineBorder(Color.blue), new EmptyBorder(5, 5, 5, 5))); textLabel.setUI(myUI); textLabel.setFont(new Font("Serif", Font.ITALIC, 24)); this.add(sizeLabel); this.add(textLabel); this.addComponentListener(new ComponentAdapter() { f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(this); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true);
/** * Builds the players list field (containing the amount of players logged in that world). */ private JPanel buildPlayersField() { JPanel column = new JPanel(new BorderLayout()); column.setBorder(new EmptyBorder(0, 5, 0, 5)); playerCountField = new JLabel(world.getPlayers() + ""); playerCountField.setFont(FontManager.getRunescapeSmallFont()); column.add(playerCountField, BorderLayout.WEST); return column; }
setLayout(new BorderLayout()); setBorder(new EmptyBorder(7, 0, 0, 0)); JPanel topContainer = new JPanel(); topContainer.setBorder(new EmptyBorder(7, 7, 6, 0)); topContainer.setLayout(new BorderLayout()); topContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); JPanel infoPanel = new JPanel(); infoPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); infoPanel.setLayout(new GridLayout(2, 1)); infoPanel.setBorder(new EmptyBorder(4, 4, 4, 0));
@Override public void run () { JPanel panel = new JPanel(new FlowLayout()); JPanel textPanel = new JPanel() { public boolean isOptimizedDrawingEnabled () { return false; textPanel.add(textField); final JLabel placeholderLabel = new JLabel(hint); placeholderLabel.setForeground(Color.GRAY); placeholderLabel.setAlignmentX(0.0f); placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));
topPanel = new JPanel(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); EmptyBorder eb = new EmptyBorder(new Insets(10, 10, 10, 10)); tPane.setBorder(eb); topPanel.add(tPane); appendToPane(tPane, "flow", Color.ORANGE); getContentPane().add(topPanel); pack(); setVisible(true);
/** * Builds the world list field (containing the country's flag and the world index). */ private JPanel buildWorldField() { JPanel column = new JPanel(new BorderLayout(7, 0)); column.setBorder(new EmptyBorder(0, 5, 0, 5)); worldField = new JLabel(world.getId() + ""); JLabel flag = new JLabel(getFlag(world.getLocation())); column.add(flag, BorderLayout.WEST); column.add(worldField, BorderLayout.CENTER); return column; }
@PostConstruct public void init() { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent windowEvent) { dispose(); } }); connectionInfoPanel.setBorder(new EmptyBorder(0, 0, 5, 0)); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); mainPanel.add(connectionInfoPanel, BorderLayout.NORTH); mainPanel.add(portMappingListView.asUIComponent(), BorderLayout.CENTER); mainPanel.add(portMappingEditView.asUIComponent(), BorderLayout.SOUTH); add(mainPanel); setMinimumSize(new Dimension(600, 550)); setPreferredSize(new Dimension(600, 550)); pack(); setVisible(true); }
@Override public void run () { JPanel panel = new JPanel(new FlowLayout()); JPanel textPanel = new JPanel() { public boolean isOptimizedDrawingEnabled () { return false; textPanel.add(textField); final JLabel placeholderLabel = new JLabel(hint); placeholderLabel.setForeground(Color.GRAY); placeholderLabel.setAlignmentX(0.0f); placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));
JPanel fontTable = new JPanel(new BorderLayout(3, 1)); JPanel fontNameCol = new JPanel(new GridLayout(0, 1, 2, 2)); JPanel fontExampleCol = new JPanel(new GridLayout(0, 1, 2, 2)); fontTable.add(fontNameCol, BorderLayout.WEST); fontTable.add(fontExampleCol, BorderLayout.CENTER); for (int ii = 0; ii < fonts.length; ii++) { fontNameCol.add(new JLabel(fonts[ii])); fontExampleCol.add(getExampleOfFont(fonts[ii])); JPanel p = new JPanel(new BorderLayout()); p.setBorder(new EmptyBorder(border, border, border, border)); p.add(tabPane, BorderLayout.CENTER); p.setPreferredSize(new Dimension(400, 400)); JFrame f = new JFrame("Properties"); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.getContentPane().add(p, BorderLayout.CENTER); f.pack(); f.setMinimumSize(f.getPreferredSize()); f.setSize(600, 500); f.setLocationRelativeTo(null); f.setVisible(true);