private JPanel createTimePanel() { timeLabel = new JLabel("0s"); constructionSpeed = new JSlider(JSlider.HORIZONTAL, 0, 10, 0); constructionSpeed.setSnapToTicks(true); constructionSpeed.setMinorTickSpacing(1); constructionSpeed.setMajorTickSpacing(1); constructionSpeed.setPaintTicks(true); constructionSpeed.setPaintLabels(true); constructionSpeed.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { updateTotalBuildingTime(); } }); JPanel totalTimePanel = new JPanel(); totalTimePanel.setBorder(new TitledBorder("Construction Time")); totalTimePanel.add(timeLabel); totalTimePanel.setMinimumSize(new Dimension(104, 0)); totalTimePanel.setMaximumSize(new Dimension(104, 0)); totalTimePanel.setPreferredSize(new Dimension(104, 0)); JPanel constructionResearchPanel = new JPanel(); constructionResearchPanel.setBorder(new TitledBorder("Construction Research Rank")); constructionResearchPanel.add(constructionSpeed); JPanel timePanel = new JPanel(new BorderLayout()); timePanel.add(BorderLayout.WEST, totalTimePanel); timePanel.add(BorderLayout.CENTER, constructionResearchPanel); return timePanel; }
private void initialize() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); fileLabel = new JLabel(I18n.text("(no log loaded)")); fileLabel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); fileLabel.setBackground(Color.white); fileLabel.setOpaque(true); filePanel.add(fileLabel, BorderLayout.CENTER); fileSelection = new JButton("..."); fileSelection.setMargin(new Insets(1, 1, 1, 1)); fileSelection.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectFile(); } }); filePanel.add(fileSelection, BorderLayout.EAST); filePanel.setMaximumSize(new Dimension(200, 25)); add(filePanel); overlaysPanel = new JPanel(); overlaysPanel.setLayout(new BoxLayout(overlaysPanel, BoxLayout.PAGE_AXIS)); add(new JScrollPane(overlaysPanel)); }
public static JPanel createHorizontalStrut(int width) { JPanel panel = new JPanel(); final Dimension d = new Dimension(width, 0); panel.setPreferredSize(d); panel.setMaximumSize(d); return panel; }
public static JPanel createBorderLayoutLabelPanel(String label, Component content) { JPanel panel = new JPanel(new BorderLayout()); panel.add(new JLabel(label), BorderLayout.WEST); panel.add(content, BorderLayout.CENTER); panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 30)); return panel; }
@Override protected JComponent getBackButton() { final JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBackground(ClusterBrowser.BUTTON_PANEL_BACKGROUND); buttonPanel.setMinimumSize(new Dimension(0, 50)); buttonPanel.setPreferredSize(new Dimension(0, 50)); buttonPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, 50)); final MyButton overviewButton = widgetFactory.createButton( Tools.getString("ClusterBrowser.RAsOverviewButton"), BACK_TO_OVERVIEW_ICON); overviewButton.setPreferredSize(new Dimension(application.scaled(180), application.scaled(50))); overviewButton.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final ResourceAgentClassInfo raci = getBrowser().getClassInfoMap(resourceAgent.getResourceClass()); if (raci != null) { raci.selectMyself(); } } }); buttonPanel.add(overviewButton, BorderLayout.LINE_START); /* Actions */ buttonPanel.add(getActionsButton(), BorderLayout.LINE_END); return buttonPanel; }
private void createCheckBoxes() { JPanel checkboxPanel = new JPanel(); floaterBox = new JCheckBox(DISABLE_GRAVITY_FOR_SELECTED_OBJECT_CHECK_BOX); checkboxPanel.add(floaterBox); floaterBox.setFocusable(false); floaterBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { myLevelEditor.getMover().getStats().isFloating = floaterBox.isSelected(); for (GameObject g : myLevelEditor.getSelected()) { g.setIsFloating(floaterBox.isSelected()); } } }); cameraBox = new JCheckBox("Camera Toggle"); cameraBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { myLevelEditor.getMover().getStats().isCameraFollow = cameraBox.isSelected(); for (GameObject g : myLevelEditor.getSelected()) { g.setIsScreenFollowing(cameraBox.isSelected()); } } }); checkboxPanel.add(cameraBox); cameraBox.setFocusable(false); checkboxPanel.setPreferredSize(CHECKBOX_PANEL_SIZE); checkboxPanel.setMaximumSize(CHECKBOX_PANEL_SIZE); homePanel.add(checkboxPanel); }
/** Adds the button row and the Spam Button */ private void addButtonRow() { if (BUTTON_ROW != null) { SOUTH_PANEL = Box.createVerticalBox(); SOUTH_PANEL.setOpaque(false); SOUTH_PANEL.add(Box.createVerticalStrut(GUIConstants.SEPARATOR)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = GridBagConstraints.RELATIVE; gbc.weightx = 1; buttonPanel.add(BUTTON_ROW, gbc); buttonPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 64)); SOUTH_PANEL.add(buttonPanel); MAIN_PANEL.add(SOUTH_PANEL); } }
private void resetRemainderProblems() { problemDisplays = new RemainderProblemDisplay[round.getNumProblems()]; JPanel panel = new JPanel(); panel.setMinimumSize(new Dimension(2, 2)); panel.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); for (int i = round.getNumProblems() / 4 + (round.getNumProblems() % 4 == 0 ? 0 : 1); i >= 0; i--) { panel.setSize(new Dimension(370, panel.getSize().height + 60)); } panel.setLayout(new Layout(0, 4)); for (int i = 0; i < round.getNumProblems(); i++) { RemainderProblemDisplay problem = new RemainderProblemDisplay( round.getProblem(i), round.getGenerator().getParam().charAt(0)); problemDisplays[i] = problem; panel.add(problem); } panel.revalidate(); problems.setPreferredSize(new Dimension(388, 360)); problems.setViewportView(panel); problems.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); problems.revalidate(); }
private void initGui() { JComponent filler = new JComponent() { @Override public Dimension getPreferredSize() { return myTextLabel.getPreferredSize(); } }; setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(3, 20, 3, 20)); add(myTextLabel, BorderLayout.WEST); Box box = Box.createHorizontalBox(); box.add(Box.createHorizontalGlue()); JPanel panel = new JPanel(new GridLayout(1, myLabels.size(), 0, 0)); for (final JComponent myLabel : myLabels) { panel.add(myLabel); } panel.setMaximumSize(panel.getPreferredSize()); box.add(panel); box.add(Box.createHorizontalGlue()); add(box, BorderLayout.CENTER); add(filler, BorderLayout.EAST); }
private JPanel createVerticalButtonBar() { JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBackground(SIDEBAR_COLOR); buttonPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, new Color(0x333333))); buttonBar = new JPanel(); buttonBar.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(0x333333))); buttonBar.setLayout(new BoxLayout(buttonBar, BoxLayout.Y_AXIS)); buttonBar.setBackground(SIDEBAR_COLOR); buttonBar.setMaximumSize(new Dimension(BUTTON_WIDTH, 1000)); buttonBar.setMinimumSize(new Dimension(BUTTON_WIDTH, 100)); // --- buttonGroup = new ButtonGroup(); fontsButton = createButton("Fonts", Resources.loadIcon("main/fonts.png")); imagesButton = createButton("Images", Resources.loadIcon("main/images.png")); buttonBar.add(fontsButton); buttonBar.add(imagesButton); buttonPanel.add(buttonBar, BorderLayout.NORTH); buttonPanel.add(StatusBar.createStatusBar(), BorderLayout.SOUTH); return buttonPanel; }
private JPanel createCompPanel() { filesets = new Vector(); int count = installer.getIntegerProperty("comp.count"); JPanel panel = new JPanel(new GridLayout(count, 1)); String osClass = OperatingSystem.getOperatingSystem().getClass().getName(); osClass = osClass.substring(osClass.indexOf('$') + 1); for (int i = 0; i < count; i++) { String os = installer.getProperty("comp." + i + ".os"); if (os != null && !osClass.equals(os)) continue; JCheckBox checkBox = new JCheckBox( installer.getProperty("comp." + i + ".name") + " (" + installer.getProperty("comp." + i + ".disk-size") + "Mb)"); checkBox.getModel().setSelected(true); checkBox.addActionListener(this); checkBox.setRequestFocusEnabled(false); filesets.addElement(new Integer(i)); panel.add(checkBox); } Dimension dim = panel.getPreferredSize(); dim.width = Integer.MAX_VALUE; panel.setMaximumSize(dim); return panel; }
private void initialize() { setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); getTeamNameLabel().setAlignmentX(Component.LEFT_ALIGNMENT); add(getTeamNameLabel()); JPanel p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); p.setAlignmentX(Component.LEFT_ALIGNMENT); getTeamNameField().setAlignmentX(Component.LEFT_ALIGNMENT); getTeamNameField().setMaximumSize(getTeamNameField().getPreferredSize()); // getVersionField().setMaximumSize(getVersionField().getPreferredSize()); p.setMaximumSize( new Dimension(Integer.MAX_VALUE, getTeamNameField().getPreferredSize().height)); p.add(getTeamPackageLabel()); p.add(getTeamNameField()); add(p); JLabel label = new JLabel(" "); label.setAlignmentX(Component.LEFT_ALIGNMENT); add(label); label = new JLabel(" "); label.setAlignmentX(Component.LEFT_ALIGNMENT); add(label); add(getDescriptionLabel()); JScrollPane scrollPane = new JScrollPane( getDescriptionArea(), ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setMaximumSize(scrollPane.getPreferredSize()); scrollPane.setMinimumSize(new Dimension(100, scrollPane.getPreferredSize().height)); scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT); add(scrollPane); label = new JLabel(" "); label.setAlignmentX(Component.LEFT_ALIGNMENT); add(label); add(getAuthorLabel()); getAuthorField().setAlignmentX(Component.LEFT_ALIGNMENT); getAuthorField().setMaximumSize(getAuthorField().getPreferredSize()); add(getAuthorField()); label = new JLabel(" "); label.setAlignmentX(Component.LEFT_ALIGNMENT); add(label); add(getWebpageLabel()); getWebpageField().setAlignmentX(Component.LEFT_ALIGNMENT); getWebpageField().setMaximumSize(getWebpageField().getPreferredSize()); add(getWebpageField()); getWebpageHelpLabel().setAlignmentX(Component.LEFT_ALIGNMENT); add(getWebpageHelpLabel()); JPanel panel = new JPanel(); panel.setAlignmentX(Component.LEFT_ALIGNMENT); add(panel); addComponentListener(eventHandler); }
/** * Loads the tileset defined in the constructor into a JPanel which it then returns. Makes no * assumptions about height or width, which means it needs to read an extra 64 tiles at worst (32 * down to check height and 32 across for width), since the maximum height/width is 32 tiles. */ public JPanel loadTileset() { int height = MAX_TILESET_SIZE; int width = MAX_TILESET_SIZE; boolean maxHeight = false; boolean maxWidth = false; // find width int j = 0; while (!maxWidth) { try { File f = new File(tileDir + "/" + j + "_" + 0 + ".png"); ImageIO.read(f); } catch (IOException e) { width = j; maxWidth = true; } j += TILE_SIZE; } // find height int i = 0; while (!maxHeight) { try { File f = new File(tileDir + "/" + 0 + "_" + i + ".png"); ImageIO.read(f); } catch (IOException e) { height = i; maxHeight = true; } i += TILE_SIZE; } JPanel tileDisplay = new JPanel(); tileDisplay.setLayout(new GridLayout(height / TILE_SIZE, width / TILE_SIZE)); tileDisplay.setMinimumSize(new Dimension(width, height)); tileDisplay.setPreferredSize(new Dimension(width, height)); tileDisplay.setMaximumSize(new Dimension(width, height)); for (i = 0; i < height; i += TILE_SIZE) { for (j = 0; j < width; j += TILE_SIZE) { String fPath = tileDir + "/" + j + "_" + i; try { int[] mov = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; Image icon = getTile(tileDir, j, i, 1); Tile tile = new Tile(new ImageIcon(icon), "palette", 0, 0, mov, "none", false, "" + j + "_" + i); tile.addMouseListener(new PaletteButtonListener()); tile.setMaximumSize(new Dimension(TILE_SIZE, TILE_SIZE)); tile.setPreferredSize(new Dimension(TILE_SIZE, TILE_SIZE)); tile.setMinimumSize(new Dimension(TILE_SIZE, TILE_SIZE)); tileDisplay.add(tile); } catch (IOException e) { } } } return tileDisplay; }
public void configurePanel(JPanel p, int w, int h) { Dimension d = new Dimension(w, h); p.setPreferredSize(d); p.setMinimumSize(d); p.setMaximumSize(d); p.setOpaque(false); // setTransparency(p); }
private void showCommentPane() { panelComment.add(commentPane, BorderLayout.CENTER); panelComment.setSize(new Dimension(panel.getWidth() - 20, 120)); panelComment.setPreferredSize(new Dimension(panel.getWidth() - 20, 120)); panelComment.setMaximumSize(new Dimension(panel.getWidth() - 20, 120)); panelComment.revalidate(); panelComment.repaint(); }
public userListFrame() { super(defaults.uid); defaults.ULF = this; defaults.SQL = SQL; ID = defaults.idx; setIconImage(defaults.img.getImage()); add(scroll); SNameList.add(new Message(defaults.uid, ID, 0)); window.setLayout(new BoxLayout(window, BoxLayout.PAGE_AXIS)); window.setMaximumSize(new Dimension(100, 1000)); fF = new fileFrame(); setResizable(false); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS)); setVisible(true); SQL.retrieveUserList(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(Mailbox); add(start); start.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (SNameList.size() > 0) { String idxs = ""; ArrayList<String> uids = new ArrayList(); ArrayList<Integer> idxList = new ArrayList(); for (Message M : SNameList) { idxs += M.getSender() + ","; uids.add(M.getMessage()); idxList.add(M.getSender()); } idxs = idxs.substring(0, idxs.length() - 1); int group = SQL.findGroup(idxs, SNameList.size()); System.out.println("SQLResult:" + group); if (group == 0) { defaults.output.send(new Message("", -4, 0)); defaults.output.send(idxList); waitForGCon(); group = SQL.findGroup(idxs, SNameList.size()); } newConvo(group, uids); } else { JOptionPane.showMessageDialog(new JFrame(), "You must select a user!"); } } }); Mailbox.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { fF.setVisible(true); } }); setSize(110, 500); repaint(); validate(); }
public void run() { path = System.getProperty("user.dir"); System.out.println(path + "\\src\\chess\\pieces\\wpawn.png"); window = new JFrame("Chess"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setSize(700, 550); JPanel mainP = new JPanel(); mainP.setLayout(new BorderLayout()); window.add(mainP); JPanel boardBorder = new JPanel(); boardBorder.setLayout(new BoxLayout(boardBorder, BoxLayout.LINE_AXIS)); mainP.add(boardBorder, BorderLayout.CENTER); JPanel board = new JPanel(); board.setMaximumSize(new Dimension(498, 498)); board.setMinimumSize(new Dimension(498, 498)); board.setBorder(BorderFactory.createLineBorder(Color.black)); GridLayout boardG = new GridLayout(8, 8); board.setLayout(boardG); boardBorder.add(board, BorderLayout.CENTER); JPanel sidePanel = new JPanel(); GridLayout sideG = new GridLayout(0, 5); sidePanel.setLayout(sideG); mainP.add(sidePanel, BorderLayout.EAST); squares = new JLabel[8][8]; for (int j = 7; j >= 0; j--) { for (int i = 0; i < 8; i++) { squares[i][j] = new JLabel(); squares[i][j].setOpaque(true); board.add(squares[i][j]); if (i % 2 == 0) { if (j % 2 != 0) { squares[i][j].setBackground(Color.gray); } else squares[i][j].setBackground(Color.white); } else { if (j % 2 == 0) { squares[i][j].setBackground(Color.gray); } else squares[i][j].setBackground(Color.white); } } } icon = new ImageIcon(path + "\\src\\chess\\pieces\\bpawn.png"); window.setVisible(true); }
private JPanel getOptionP() { if (optionP == null) { optionP = new JPanel(); optionP.setMaximumSize(new java.awt.Dimension(32767, 32)); optionP.add(getAmpMaxL()); optionP.add(getLagTimeL()); optionP.add(getTaperL()); optionP.add(getTaperCB()); } return optionP; }
public GUI() { chat = ""; window = new JFrame("Qwirkle"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); leftPanel = new JPanel(); leftPanel.setPreferredSize(new Dimension(480, 600)); leftPanel.setMinimumSize(new Dimension(480, 600)); leftPanel.setMaximumSize(new Dimension(480, 600)); window.add(leftPanel, BorderLayout.LINE_START); rightPanel = new JPanel(); rightPanel.setPreferredSize(new Dimension(320, 600)); rightPanel.setMinimumSize(new Dimension(320, 600)); rightPanel.setMaximumSize(new Dimension(320, 600)); window.add(rightPanel, BorderLayout.LINE_END); constructGamePanel(); constructChatPanel(); }
/** * Create main panel with Manager panels on the left, result tabs on the right, and consoles in * the bottom. */ public PanelLeftRightBottom() { super(JSplitPane.VERTICAL_SPLIT, true); Preferences prefs = Preferences.userRoot().node(InjectionModel.class.getName()); int verticalSplitter = prefs.getInt(PanelLeftRightBottom.VERTICALSPLITTER_PREFNAME, 300); int horizontalSplitter = prefs.getInt(PanelLeftRightBottom.HORIZONTALSPLITTER_PREFNAME, 200); MediatorGUI.register(new AdapterLeftTabbedPane()); MediatorGUI.register(new AdapterRightTabbedPane()); // Tree and tabs on top this.leftRight = new JSplitPaneWithZeroSizeDivider(JSplitPane.HORIZONTAL_SPLIT, true); this.leftRight.setLeftComponent(MediatorGUI.left()); this.leftRight.setRightComponent(MediatorGUI.right()); this.leftRight.setDividerLocation(verticalSplitter); this.leftRight.setDividerSize(0); this.leftRight.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, HelperGUI.COMPONENT_BORDER)); this.setDividerSize(0); this.setBorder(null); JPanel leftRightBottomPanel = new JPanel(new BorderLayout()); leftRightBottomPanel.add(leftRight, BorderLayout.CENTER); ERSATZARROWPANEL.setLayout(new BorderLayout()); ERSATZARROWPANEL.setOpaque(false); ERSATZARROWPANEL.setPreferredSize(new Dimension(17, 22)); ERSATZARROWPANEL.setMaximumSize(new Dimension(17, 22)); JButton hideBottomButton = new BasicArrowButton(BasicArrowButton.NORTH); hideBottomButton.setBorderPainted(false); hideBottomButton.setOpaque(false); hideBottomButton.addActionListener(PanelLeftRightBottom.HIDESHOWPANEL); ERSATZARROWPANEL.add(Box.createHorizontalGlue()); ERSATZARROWPANEL.add(hideBottomButton, BorderLayout.EAST); ERSATZARROWPANEL.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, HelperGUI.COMPONENT_BORDER)); ERSATZARROWPANEL.setVisible(false); leftRightBottomPanel.add(ERSATZARROWPANEL, BorderLayout.SOUTH); // Setting for top and bottom components this.setTopComponent(leftRightBottomPanel); MediatorGUI.register(new PanelBottom()); this.setBottomComponent(MediatorGUI.bottomPanel()); this.setDividerLocation(594 - horizontalSplitter); // defines left and bottom pane this.setResizeWeight(1); }
private Component createPlayButtonPanel() { JPanel buttonJP = new JPanel(); buttonJP.setBackground(new Color(0x8DB6CD)); buttonJP.setSize(getSize().width, 50); buttonJP.setPreferredSize(buttonJP.getSize()); buttonJP.setMaximumSize(buttonJP.getSize()); buttonJP.setVisible(true); generatePlayButtonPanelContent(buttonJP); return buttonJP; }
// добавление кнопок(0,1,2,3,4,5,6,7,8,9,*,#) public JPanel addNumberButtons(JTextField DispField) { final JTextField Field = DispField; JPanel ButtonPanel = new JPanel(); ButtonPanel.setLayout(new GridLayout(4, 3)); ButtonPanel.setPreferredSize(new Dimension(500, 320)); ButtonPanel.setMaximumSize(new Dimension(500, 500)); JButton[] NumButtons = new JButton[10]; JButton StarButtons = new JButton("*"); StarButtons.setFont(NumButtonsFont); StarButtons.setPreferredSize(new Dimension(100, 75)); StarButtons.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { if (Field.getText().length() < MaxChars) Field.setText(Field.getText() + "*"); if (!MainFrame.RedirectPanel.isVisible()) CallButton.setEnabled(true); } }); JButton latticeButtons = new JButton("#"); latticeButtons.setFont(NumButtonsFont); latticeButtons.setPreferredSize(new Dimension(100, 75)); latticeButtons.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { if (Field.getText().length() < MaxChars) Field.setText(Field.getText() + "#"); if (!MainFrame.RedirectPanel.isVisible()) CallButton.setEnabled(true); } }); for (int i = 0; i < 10; i++) { final String name = "" + i; NumButtons[i] = new JButton("" + i); NumButtons[i].setFont(NumButtonsFont); NumButtons[i].setPreferredSize(new Dimension(100, 75)); NumButtons[i].addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { if (Field.getText().length() < MaxChars) Field.setText(Field.getText() + name); if (!MainFrame.RedirectPanel.isVisible()) CallButton.setEnabled(true); } }); } for (int i = 1; i <= 9; i++) { ButtonPanel.add(NumButtons[i]); } ButtonPanel.add(StarButtons); ButtonPanel.add(NumButtons[0]); ButtonPanel.add(latticeButtons); return ButtonPanel; }
public JPanel createTabButton(final Tab tab) { final JPanel panel = new JPanel(); final JButton button = new JButton("Bot"); final JPopupMenu closeMenu = new JPopupMenu(); final JMenuItem closeItem = new JMenuItem("Close"); button.setIcon(Configuration.icon("res/icon_tab_small.png")); button.setBounds(0, 0, 84, 24); button.setFocusable(false); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { updateTabs(tab); } }); button.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent e) { checkForTriggerEvent(e); } public void mouseReleased(MouseEvent e) { checkForTriggerEvent(e); } private void checkForTriggerEvent(MouseEvent e) { if (e.isPopupTrigger()) { closeMenu.show(e.getComponent(), e.getX(), e.getY()); } } }); closeItem.addActionListener( new ActionListener() { @SuppressWarnings("deprecation") public void actionPerformed(ActionEvent e) { closeTab(tab); tab.getContent().getApplet().stop(); tab.getContent().getApplet().destroy(); tab.getContent().getBot().getThread().interrupt(); tab.getContent().getBot().getThread().stop(); } }); closeMenu.add(closeItem); panel.setPreferredSize(new Dimension(84, 32)); panel.setMinimumSize(new Dimension(84, 32)); panel.setMaximumSize(new Dimension(84, 32)); panel.setLayout(null); panel.add(button); return panel; }
/** Erstellt die Oberfläche. */ private void jbInit() { m_panel = new JParameterPanel(m_name + ":", "ComboBox", m_selectables, 100, 20, 100, 20); m_panel.setSize(new Dimension(200, 20)); m_okButton = new JButton("OK"); m_okButton.setBorder(BorderFactory.createRaisedBevelBorder()); m_okButton.setActionCommand("OK"); m_okButton.setText(" OK "); m_okButton.setSize(new Dimension(100, 30)); m_okButton.addActionListener(new JSelectionDialog_m_okButton_actionAdapter(this)); GridLayout gridLayout = new GridLayout(1, 3, 10, 10); JPanel panel = new JPanel(); JPanel leftPanel = new JPanel(); JPanel rightPanel = new JPanel(); JPanel buttonPanel = new JPanel(); buttonPanel.setMaximumSize(new Dimension(100, 30)); buttonPanel.setMinimumSize(new Dimension(100, 30)); buttonPanel.setPreferredSize(new Dimension(100, 30)); buttonPanel.add(m_okButton); leftPanel.setMaximumSize(new Dimension(50, 30)); leftPanel.setMinimumSize(new Dimension(50, 30)); leftPanel.setPreferredSize(new Dimension(50, 30)); rightPanel.setMinimumSize(new Dimension(50, 30)); rightPanel.setMaximumSize(new Dimension(50, 30)); rightPanel.setPreferredSize(new Dimension(50, 30)); panel.setLayout(gridLayout); panel.add(leftPanel); panel.add(buttonPanel); panel.add(rightPanel); BorderLayout layout = new BorderLayout(); this.getContentPane().setLayout(layout); this.getContentPane().add(m_panel, BorderLayout.NORTH); this.getContentPane().add(panel, BorderLayout.SOUTH); Dimension ownDimension = new Dimension(200, 90); this.setSize(ownDimension); this.setBounds(650, 500, ownDimension.width, ownDimension.height); }
private void setPalette() { mZoomPalettePanel.removeAll(); if (mVisualConfig.getBlocksColorRange() == null) { return; } List<Color> colorRange = null; if (mVisualConfig.getBlocksColorRange() == null) { colorRange = Consts.defaultColorRange; } else { colorRange = mVisualConfig.getBlocksColorRange(); } JLabel paletteLabel = new JLabel("Zoom Palette:"); paletteLabel.setAlignmentY(Component.BOTTOM_ALIGNMENT); paletteLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3)); mZoomPalettePanel.add(paletteLabel); mPalettePanel = new JPanel(); mPalettePanel.setLayout(new BoxLayout(mPalettePanel, BoxLayout.X_AXIS)); mZoomPalettePanel.add(mPalettePanel); for (int i = 0; i < colorRange.size(); i++) { JPanel paletteSquarePanel = new JPanel(); paletteSquarePanel.setLayout(new BoxLayout(paletteSquarePanel, BoxLayout.Y_AXIS)); Color color = colorRange.get(i); JPanel colorPanel = new JPanel(); colorPanel.setBackground(color); colorPanel.setMinimumSize(new Dimension(20, 20)); colorPanel.setPreferredSize(new Dimension(20, 20)); colorPanel.setMaximumSize(new Dimension(20, 20)); paletteSquarePanel.add(colorPanel); String value = " "; if (i == 0 && mVisualConfig.getRangeLowValue() != null) { value = Integer.toString(mVisualConfig.getRangeLowValue()); } else if (i == colorRange.size() - 1 && mVisualConfig.getRangeHighValue() != null) { value = Integer.toString(mVisualConfig.getRangeHighValue()); } JLabel valueLabel = new JLabel(value); valueLabel.setAlignmentX(Component.CENTER_ALIGNMENT); paletteSquarePanel.add(valueLabel); mPalettePanel.add(paletteSquarePanel); } }
private JPanel addMethodCombo() { JPanel methodPanel = new JPanel(new BorderLayout()); JComboBox<RestRequestInterface.RequestMethod> methodComboBox = new JComboBox<RestRequestInterface.RequestMethod>(new RestRequestMethodModel(getRequest())); methodComboBox.setSelectedItem(getRequest().getMethod()); JLabel methodLabel = new JLabel("Method"); methodPanel.add(methodLabel, BorderLayout.NORTH); methodPanel.add(methodComboBox, BorderLayout.SOUTH); methodPanel.setMinimumSize(new Dimension(75, STANDARD_TOOLBAR_HEIGHT)); // TODO: remove hard coded height adjustment methodPanel.setMaximumSize(new Dimension(75, STANDARD_TOOLBAR_HEIGHT + 10)); return methodPanel; }
private void constructGamePanel() { JPanel gamePanel = new JPanel(new GridLayout(12, 16)); gamePanel.setPreferredSize(new Dimension(480, 360)); gamePanel.setMaximumSize(new Dimension(480, 360)); leftPanel.add(gamePanel, BorderLayout.PAGE_START); for (int y = 0; y < 12; ++y) { for (int x = 0; x < 16; ++x) { JButton button = new JButton("*"); button.setMinimumSize(new Dimension(30, 30)); gamePanel.add(button); } } }
private JPanel getOptionP() { if (optionPanel == null && SmoothButtonGroup == null) { optionPanel = new JPanel(); optionPanel.setMaximumSize(new java.awt.Dimension(32767, 32)); SmoothButtonGroup = new ButtonGroup(); SmoothButtonGroup.add(getRawRB()); SmoothButtonGroup.add(getSmoothRB()); SmoothButtonGroup.add(getRawAndSmoothRB()); optionPanel.add(getRawRB()); optionPanel.add(getSmoothRB()); optionPanel.add(getRawAndSmoothRB()); } return optionPanel; }
private void jbInit() throws Exception { setTitle("DIARIO CONTADO"); frmDatosVenta = new FrmDatosVenta(engine); frmDatosVenta.setLocationRelativeTo(this); getContentPane().setLayout(borderLayout1); jLabel1.setFont(new java.awt.Font("Arial", Font.PLAIN, 18)); jLabel1.setToolTipText(""); jLabel1.setText("DIARIO DE ENTRADAS"); pnlCentro.setLayout(borderLayout2); cmdCerrar.setText("CERRAR"); cmdCerrar.addActionListener(new FrmDiarioDeEntradas_cmdCerrar_actionAdapter(this)); cmdImprimir.setText("IMPRIMIR"); tblDiario.setBackground(new Color(255, 240, 255)); tblDiario.setFont(new java.awt.Font("Arial", Font.PLAIN, 12)); tblDiario.setModel(modelDiarioVentasDeContado1); tblDiario.addMouseListener(new FrmDiarioDeEntradas_tblDiario_mouseAdapter(this)); this.addWindowListener(new FrmDiarioDeEntradas_this_windowAdapter(this)); jLabel2.setFont(new java.awt.Font("Arial", Font.BOLD, 20)); jLabel2.setText("Total:"); lblTotal.setFont(new java.awt.Font("Arial", Font.BOLD, 20)); lblTotal.setText(""); this.getContentPane().setBackground(Color.white); this.addKeyListener(new FrmDiarioDeEntradas_this_keyAdapter(this)); pnlCentro.setBackground(Color.white); pnlNorte.setBackground(Color.white); pnlNorte.setLayout(borderLayout4); scrollDiario.getViewport().setBackground(Color.white); scrollDiario.setPreferredSize(new Dimension(800, 600)); lblFecha.setFont(new java.awt.Font("Arial", Font.BOLD, 16)); lblFecha.setText(""); jPanel1.setLayout(borderLayout3); pnlSur.setMaximumSize(new Dimension(4000, 200)); jPanel1.setBackground(Color.white); jPanel2.setBackground(Color.white); this.getContentPane().add(pnlCentro, java.awt.BorderLayout.CENTER); pnlCentro.add(pnlNorte, java.awt.BorderLayout.CENTER); pnlCentro.add(scrollDiario, java.awt.BorderLayout.NORTH); scrollDiario.getViewport().add(tblDiario); this.getContentPane().add(pnlSur, java.awt.BorderLayout.SOUTH); pnlSur.add(cmdImprimir); pnlSur.add(cmdCerrar); this.getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH); jPanel1.add(lblFecha, java.awt.BorderLayout.EAST); jPanel1.add(jLabel1, java.awt.BorderLayout.WEST); pnlNorte.add(jPanel2, java.awt.BorderLayout.EAST); jPanel2.add(jLabel2); jPanel2.add(lblTotal); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
@Override protected void initialize() { super.initialize(); final JPanel pnl = getQueryComponentsPanel(); pnl.setMinimumSize(new Dimension(60, 56)); pnl.setPreferredSize(new Dimension(500, 56)); pnl.setMaximumSize(new Dimension(5000, 56)); // move the query components panel to be at the top remove(pnl); add(pnl, BorderLayout.NORTH); // add the group list panel add(getGroupLabeledComponent(), BorderLayout.CENTER); }