public Frm() { left.setPreferredSize(new Dimension(110, 200)); center.setPreferredSize(new Dimension(200, 200)); this.setLayout(new BorderLayout()); left.setBackground(Color.white); center.setBackground(Color.blue); this.add(left, BorderLayout.WEST); this.add(center, BorderLayout.CENTER); }
public JPanel createContentPane() { // We create a bottom JPanel to place everything on. JPanel totalGUI = new JPanel(); // We set the layout of the main JPanel to be BoxLayout. // LINE_AXIS sets them left to right, PAGE_AXIS sets them // from top to bottom. totalGUI.setLayout(new BoxLayout(totalGUI, BoxLayout.LINE_AXIS)); JPanel redPanel = new JPanel(); redPanel.setBackground(Color.red); redPanel.setMinimumSize(new Dimension(50, 50)); redPanel.setPreferredSize(new Dimension(50, 50)); totalGUI.add(redPanel); // This is the first spacer. This creates a spacer 10px wide that // will never get bigger or smaller. totalGUI.add(Box.createRigidArea(new Dimension(10, 0))); JPanel yellowPanel = new JPanel(); yellowPanel.setBackground(Color.yellow); yellowPanel.setPreferredSize(new Dimension(50, 50)); totalGUI.add(yellowPanel); // This spacer takes any spare space and places it as part of the spacer // If you drag the window wider, the space will get wider. totalGUI.add(Box.createHorizontalGlue()); JPanel greenPanel = new JPanel(); greenPanel.setBackground(Color.green); greenPanel.setPreferredSize(new Dimension(50, 50)); totalGUI.add(greenPanel); // This spacer is a custom spacer. // The minimum size acts like a rigid area that // will not get any smaller than 10 pixels on the x-axis (horizontal) // and not get any smaller than 50 pixels on the y axis (vertical). // The way the maximum size is set up means the spacer acts like glue // and will expand to fit the available space. Dimension minSize = new Dimension(10, 50); Dimension prefSize = new Dimension(10, 50); Dimension maxSize = new Dimension(Short.MAX_VALUE, 50); totalGUI.add(new Box.Filler(minSize, prefSize, maxSize)); JPanel bluePanel = new JPanel(); bluePanel.setBackground(Color.blue); bluePanel.setPreferredSize(new Dimension(50, 50)); totalGUI.add(bluePanel); totalGUI.setOpaque(true); return totalGUI; }
public static void main(String[] args) { JFrame frame = new JFrame("Demo of Additional Borders"); frame.setIconImage(JideIconsFactory.getImageIcon(JideIconsFactory.JIDE32).getImage()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS, 10)); JTextArea textField = new JTextArea(); JPanel border = new JPanel(new BorderLayout()); border.setPreferredSize(new Dimension(100, 100)); border.add(new JScrollPane(textField), BorderLayout.CENTER); border.setBorder( new JideTitledBorder( new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH), "PartialEtchedBorder")); JTextArea textField2 = new JTextArea(); JPanel border2 = new JPanel(new BorderLayout()); border2.setPreferredSize(new Dimension(100, 100)); border2.add(new JScrollPane(textField2), BorderLayout.CENTER); border2.setBorder( new JideTitledBorder( new PartialLineBorder(Color.darkGray, 1, PartialSide.NORTH), "PartialLineBorder")); JTextArea textField3 = new JTextArea(); JPanel border3 = new JPanel(new BorderLayout()); border3.setPreferredSize(new Dimension(100, 100)); border3.add(new JScrollPane(textField3), BorderLayout.CENTER); border3.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder( new PartialLineBorder(Color.gray, 1, true), "Rounded Corners Border"), BorderFactory.createEmptyBorder(0, 6, 4, 6))); panel.add(border, JideBoxLayout.FLEXIBLE); panel.add(Box.createVerticalStrut(12)); panel.add(border2, JideBoxLayout.FLEXIBLE); panel.add(Box.createVerticalStrut(12)); panel.add(border3, JideBoxLayout.FLEXIBLE); panel.add(Box.createGlue(), JideBoxLayout.VARY); panel.setPreferredSize(new Dimension(500, 400)); frame.getContentPane().add(panel, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }
private JPanel makeButtonPanel() { JPanel p = new JPanel(); p.setLayout(new GridLayout(5, 1)); p.setPreferredSize(new Dimension(150, 160)); JLabel translationLabel = new JLabel("Set Translation (nm)", JLabel.CENTER); p.add(translationLabel); JLabel[] label = new JLabel[] { new JLabel("dx: ", JLabel.RIGHT), new JLabel("dy: ", JLabel.RIGHT), new JLabel("dz: ", JLabel.RIGHT) }; JPanel[] shiftPanel = new JPanel[3]; for (int i = 0; i < 3; i++) { shiftPanel[i] = new JPanel(); shiftPanel[i].add(label[i]); shiftTF[i] = new ValueTextField("0.0", 5, ValueTextField.DOUBLE, Constraints.NO_CONSTRAINT, false); shiftPanel[i].add(shiftTF[i]); p.add(shiftPanel[i]); } JPanel buttonPanel = new JPanel(); shift = new JButton("Translate"); buttonPanel.add(shift); p.add(buttonPanel); JPanel rPanel = new JPanel(); rPanel.add(p); return rPanel; }
private void buildExternalsPanel() { FormBuilder builder = FormBuilder.create().layout(new FormLayout("fill:pref:grow", "p")); int row = 1; for (ExternalFileEntry efe : externals) { builder.add(efe.getPanel()).xy(1, row); builder.appendRows("2dlu, p"); row += 2; } builder.add(Box.createVerticalGlue()).xy(1, row); builder.appendRows("2dlu, p, 2dlu, p"); builder.add(addExtPan).xy(1, row + 2); builder.add(Box.createVerticalGlue()).xy(1, row + 2); // builder.getPanel().setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.green)); // externalFilesPanel.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.red)); JScrollPane pane = new JScrollPane(builder.getPanel()); pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); externalFilesPanel.setMinimumSize(new Dimension(400, 400)); externalFilesPanel.setPreferredSize(new Dimension(400, 400)); externalFilesPanel.removeAll(); externalFilesPanel.add(pane, BorderLayout.CENTER); externalFilesPanel.revalidate(); externalFilesPanel.repaint(); }
HeatMapControls(ControlBar creator) { super(); parent = creator; setLayout(new BorderLayout()); super.setPreferredSize(new Dimension(255, 170)); String[] organisms = SpeciesTable.getOrganisms(); String[] options = new String[organisms.length + 1]; options[0] = "None"; for (int i = 0; i < organisms.length; i++) { options[i + 1] = organisms[i]; } species = new JComboBox(options); species.addActionListener(this); for (String str : SpeciesTable.getOrganisms()) {} super.add(species, BorderLayout.SOUTH); super.add(new Gradient(), BorderLayout.CENTER); super.add(new JLabel("Least"), BorderLayout.WEST); super.add(new JLabel("Most"), BorderLayout.EAST); super.add(new JLabel("Heat Map Controls"), BorderLayout.NORTH); super.setVisible(true); }
private JPanel getMainPanel() { if (mainPanel == null) { mainPanel = new JPanel(); mainPanel.setPreferredSize(new Dimension(550, 300)); GridBagLayout layout = new GridBagLayout(); mainPanel.setLayout(layout); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 2; constraints.weighty = 1; constraints.anchor = GridBagConstraints.NORTHWEST; constraints.gridwidth = 2; layout.setConstraints(getAvailableRobotsPanel(), constraints); mainPanel.add(getAvailableRobotsPanel()); constraints.gridwidth = 1; constraints.weightx = 0; constraints.weighty = 0; constraints.anchor = GridBagConstraints.CENTER; layout.setConstraints(getButtonsPanel(), constraints); mainPanel.add(getButtonsPanel()); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.weightx = 1; constraints.weighty = 1; constraints.anchor = GridBagConstraints.NORTHWEST; layout.setConstraints(getSelectedRobotsPanel(), constraints); mainPanel.add(getSelectedRobotsPanel()); } return mainPanel; }
public static void main(String[] args) { int i = 3; // Default to 3 if (args.length >= 1) { try { i = Integer.parseInt(args[0]); } catch (NumberFormatException e) { System.out.println("Usage: 'java SierpinskyTriangle [level]'\nNow setting level to " + i); } } final int level = i; JFrame frame = new JFrame("Sierpinsky Triangle - Java"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel() { @Override public void paintComponent(Graphics g) { g.setColor(Color.BLACK); drawSierpinskyTriangle(level, 20, 20, 360, (Graphics2D) g); } }; panel.setPreferredSize(new Dimension(400, 400)); frame.add(panel); frame.pack(); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); }
private void buildInterface() { FlowLayout layout = new FlowLayout(FlowLayout.CENTER); setLayout(layout); JPanel sliderPane = new JPanel(); sliderPane.setPreferredSize(new Dimension(190, 100)); GridLayout layout2 = new GridLayout(4, 2); sliderPane.setLayout(layout2); sliderPane.add(prodLabel); sliderPane.add(prodArea); sliderPane.add(herbLabel); sliderPane.add(herbArea); sliderPane.add(predLabel); sliderPane.add(predArea); sliderPane.add(decoLabel); sliderPane.add(decoArea); add(sliderPane); add(reset); add(triggerGo); add(triggerSeed); // add(Box.createRigidArea(new Dimension(50,10))); // labelContainer.setBorder(new LineBorder(Color.BLACK)); // labelContainer.setPreferredSize(new Dimension(196,200)); GridLayout gridLayout = new GridLayout(4, 1); labelContainer.setLayout(gridLayout); labelContainer.add(activeProdLabel); labelContainer.add(activeHerbLabel); labelContainer.add(activePredLabel); labelContainer.add(activeDecoLabel); labelContainer.setVisible(false); g1 = new Graph(196, 170, panel.life.prodStore, panel); add(g1); add(labelContainer); }
public JPanel bookpanel() { JPanel inner = new JPanel(); inner.setLayout(new BoxLayout(inner, BoxLayout.Y_AXIS)); JLabel title = new JLabel("Book:"); title.setFont(titleFont); inner.add(title); // Add a panel as a spacer JPanel spacer = new JPanel(); spacer.setPreferredSize(new Dimension(400, 1)); spacer.setBackground(Color.black); inner.add(spacer); JLabel Clabel_1 = new JLabel("Enter author details:"); Clabel_1.setFont(mainFont); inner.add(Clabel_1); JTextField Ctextfield_1 = new JTextField(20); Ctextfield_1.setText(this.auto_book_author); inner.add(Ctextfield_1); JLabel Clabel_2 = new JLabel("Enter title of publication:"); Clabel_2.setFont(mainFont); inner.add(Clabel_2); JTextField Ctextfield_2 = new JTextField(20); Ctextfield_2.setText(this.auto_book_title); inner.add(Ctextfield_2); JLabel Clabel_3 = new JLabel("Enter date of publication:"); Clabel_3.setFont(mainFont); inner.add(Clabel_3); JTextField Ctextfield_3 = new JTextField(20); Ctextfield_3.setText(this.auto_book_date); inner.add(Ctextfield_3); JLabel Clabel_4 = new JLabel("Enter publisher:"); Clabel_4.setFont(mainFont); inner.add(Clabel_4); JTextField Ctextfield_4 = new JTextField(20); Ctextfield_4.setText(this.auto_book_publisher); inner.add(Ctextfield_4); JLabel Clabel_5 = new JLabel("Enter place of publication:"); Clabel_5.setFont(mainFont); inner.add(Clabel_5); JTextField Ctextfield_5 = new JTextField(20); inner.add(Ctextfield_5); JButton Cbutton = new JButton("Create reference"); inner.add(Cbutton); Cbutton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println(Ctextfield_1.getText() + " is the author"); Ctextfield_5.setText(Ctextfield_1.getText() + "\"" + Ctextfield_4.getText() + "\""); } }); return inner; }
public JPanel createLaneTrafficGenerator( Route in, RouteAspect aspect, Engine engine, RouteAspect routes) { JPanel controller = vertical(); TrafficGenerator generator = new TrafficGenerator(in, engine, routes); aspect.addTrafficGenerator(generator); IntTextField imprecision = new IntTextField(); IntTextField traffic = new IntTextField(); JLabel message = new JLabel(); generator.configure(0, DEFAULT_TRAFFIC_PER_HOUR); imprecision.setText("" + 0); traffic.setText("" + DEFAULT_TRAFFIC_PER_HOUR); JButton validate = new JButton("Valider") { public TrafficGenerator holder = generator; }; validate.addActionListener( (e) -> { int imp = imprecision.getValue(); int traf = traffic.getValue(); if (traf < 0) traf = 0; if (imp < 0) imp = 0; if (imp > 100) imp = 100; generator.configure(imp, traf); message.setText("Modifcation prise en compte"); }); controller.add(horizontal(new JLabel("Imprecision (+/-) "), imprecision)); controller.add(horizontal(new JLabel("Densite (voiture/heure)"), traffic)); controller.add(horizontal(validate, message)); controller.setPreferredSize(new Dimension(100, 100)); controller.setSize(100, 100); return controller; }
/** Description of the Method */ public void init() { // super.init(); size = new Dimension(570, 570); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(borderLayout1); Dimension d = messagePanel.getSize(); d.height += 20; messagePanel.setPreferredSize(d); contentPane.add(messagePanel, BorderLayout.SOUTH); contentPane.setOpaque(true); userPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(2, 2, 2, 2); messagePanel.setLayout(borderLayout5); contentPane.setOpaque(true); contentPane.setBackground(Color.white); this.setSize(size); messagePanel.add(labelMessage, BorderLayout.NORTH); // Logg.logg("MhClient: Före XttTree-skapande", 6); this.mhTable = new MhTable(root, false, this.labelMessage); // Logg.logg("MhClient: mhTable-skapande klart", 6); this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER); }
public ContactListUI() { cList = new ContactList("contacts.txt"); // Set up the To: and From: panel JPanel staticPanel = new JPanel(); staticPanel.setPreferredSize(new Dimension(100, 100)); staticPanel.setLayout(new GridLayout(3, 1)); to = new JButton("To: "); staticPanel.add(to); staticPanel.add(new JLabel(" ")); staticPanel.add(new JLabel("From:", JLabel.CENTER)); // Set up the panel for addContacts and removeContacts; JPanel buttonPanel = new JPanel(); addContacts = new JButton("Add"); removeContacts = new JButton("Remove"); editContacts = new JButton("Edit"); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(addContacts); buttonPanel.add(removeContacts); buttonPanel.add(editContacts); // Set up the panel with the contact selection and buttons JPanel dynPanel = new JPanel(); toText = new JTextField(); fromText = new JTextField(); dynPanel.setPreferredSize(new Dimension(300, 100)); dynPanel.setLayout(new GridLayout(3, 1)); dynPanel.add(toText); dynPanel.add(buttonPanel); dynPanel.add(fromText); // Add everything to a ContactUI to.addActionListener(this); addContacts.addActionListener(this); removeContacts.addActionListener(this); editContacts.addActionListener(this); this.setPreferredSize(new Dimension(500, 125)); this.setLayout(new FlowLayout()); this.add(staticPanel); this.add(dynPanel); deleteContact = new JButton("Delete"); deleteContact.addActionListener(this); addSendContacts = new JButton("Confirm"); addSendContacts.addActionListener(this); }
// Initialize all the GUI components and display the frame private static void initGUI() { // Set up the status bar statusField = new JLabel(); statusField.setText(statusMessages[DISCONNECTED]); statusColor = new JTextField(1); statusColor.setBackground(Color.red); statusColor.setEditable(false); statusBar = new JPanel(new BorderLayout()); statusBar.add(statusColor, BorderLayout.WEST); statusBar.add(statusField, BorderLayout.CENTER); // Set up the options pane JPanel optionsPane = initOptionsPane(); // Set up the chat pane JPanel chatPane = new JPanel(new BorderLayout()); chatText = new JTextArea(10, 20); chatText.setLineWrap(true); chatText.setEditable(false); chatText.setForeground(Color.blue); JScrollPane chatTextPane = new JScrollPane( chatText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); chatLine = new JTextField(); chatLine.setEnabled(false); chatLine.addActionListener( new ActionAdapter() { public void actionPerformed(ActionEvent e) { String s = chatLine.getText(); if (!s.equals("")) { appendToChatBox("OUTGOING: " + s + "\n"); chatLine.selectAll(); // Send the string sendString(s); } } }); chatPane.add(chatLine, BorderLayout.SOUTH); chatPane.add(chatTextPane, BorderLayout.CENTER); chatPane.setPreferredSize(new Dimension(200, 200)); // Set up the main pane JPanel mainPane = new JPanel(new BorderLayout()); mainPane.add(statusBar, BorderLayout.SOUTH); mainPane.add(optionsPane, BorderLayout.WEST); mainPane.add(chatPane, BorderLayout.CENTER); // Set up the main frame mainFrame = new JFrame("Simple TCP Chat"); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainFrame.setContentPane(mainPane); mainFrame.setSize(mainFrame.getPreferredSize()); mainFrame.setLocation(200, 200); mainFrame.pack(); mainFrame.setVisible(true); }
/** * 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; }
private void syncSizeToCertificateDetail() { if (usermessage != null) { usermessage.setPreferredSize(cd.getPreferredSize()); usermessage.setMinimumSize(cd.getMinimumSize()); } detailPane.setPreferredSize(cd.getPreferredSize()); detailPane.setMinimumSize(cd.getMinimumSize()); }
@Override protected JComponent createCenterPanel() { final JPanel panel = new JPanel(new BorderLayout()); JTextArea area = new JTextArea( "The imported language extends other languages.\n" + "It might be useful to import all or some of them."); area.setEditable(false); area.setBackground(this.getContentPane().getBackground()); area.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5)); panel.add(area, BorderLayout.NORTH); JPanel center = new JPanel(new GridBagLayout()); JTextArea label = new JTextArea("Select additional languages to import:"); label.setEditable(false); label.setBackground(getContentPane().getBackground()); label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); center.add( label, new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); myList = new JBList(myCandidates.toArray()); myList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); myList.setSelectionInterval(0, myList.getModel().getSize() - 1); myList.setCellRenderer(new MyDefaultListCellRenderer()); myList.setBorder(BorderFactory.createEtchedBorder()); center.add( ScrollPaneFactory.createScrollPane(myList), new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); panel.add(center, BorderLayout.CENTER); panel.setPreferredSize(new Dimension(400, 250)); return panel; }
public void addPanel(String name, JPanel panel) { if (tabbedPane.getTabCount() == 0) { preffered = panel.getPreferredSize(); } panel.setPreferredSize(preffered); tabbedPane.add(name, panel); }
/** Creates an instance of the <tt>AdvancedConfigurationPanel</tt>. */ public AdvancedConfigurationPanel() { super(new BorderLayout(10, 0)); initList(); centerPanel.setPreferredSize(new Dimension(500, 500)); add(centerPanel, BorderLayout.CENTER); }
@Nullable @Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); panel.add(createNamePanel(), BorderLayout.CENTER); if (myOccurrencesCount > 1) panel.add(createReplaceAllPanel(), BorderLayout.SOUTH); panel.setPreferredSize(new Dimension(myNameField.getWidth(), -1)); return panel; }
public void createPanel3() { panel3 = new JPanel(); panel3.setLayout(new BorderLayout()); panel3.setPreferredSize(new Dimension(400, 100)); panel3.setMinimumSize(new Dimension(100, 50)); panel3.add(new JLabel("Notes:"), BorderLayout.NORTH); panel3.add(new JTextArea(), BorderLayout.CENTER); }
public UnitTestRunner() { mainPane = new JPanel(new GridBagLayout()); mainPane.setMinimumSize(new Dimension(0, 0)); mainPane.setPreferredSize(new Dimension(270, 200)); minPane = new JPanel(new GridBagLayout()); initComponents(); addGrid( mainPane, toolbar, 0, 0, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST); addGrid( mainPane, new JSeparator(), 0, 1, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST); addGrid( mainPane, fCounterPanel, 0, 2, 2, GridBagConstraints.NONE, 0.0, GridBagConstraints.WEST); addGrid( mainPane, fProgressIndicator, 0, 3, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST); addGrid( mainPane, new JSeparator(), 0, 5, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST); addGrid( mainPane, new JLabel("Results:"), 0, 6, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST); addGrid(mainPane, fTestViewTab, 0, 7, 2, GridBagConstraints.BOTH, 1.0, GridBagConstraints.WEST); // _lineNoOfTest = new HashMap<String, Integer>(); }
/** methode creatWidget dimmensionne panelConnect et panelInit */ public void createWidget() { panConn = createPanelConnect(); panConn.setSize(new Dimension(350, 100)); panInit = createPanelInit(); panInit.setPreferredSize(new Dimension(1200, 300)); panParty = createPanelPlay(); setContentPane(panConn); }
/*Creates the South section of the mancala board. */ private JPanel southBoardPanel() { JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 300, 50)); p1Label = new JLabel("Player 1"); p1Label.setFont(new Font("Belta Regular", Font.BOLD, 50)); p1Label.setForeground(new Color(203, 159, 0)); southPanel.add(p1Label); southPanel.setOpaque(false); southPanel.setPreferredSize(new Dimension(600, 100)); return southPanel; }
public World() { super(GAME_TITLE); _fileFilter = new FileNameExtensionFilter("Blockamon SAVE", "save"); this.setLayout(new BorderLayout()); inBattle = false; playingField = new JPanel(null); playingField.setBorder(BorderFactory.createLineBorder(Color.black)); playingField.setPreferredSize(new Dimension(400, 300)); worldSize = playingField.getPreferredSize(); }
public ColorRenderer() { panel = new JPanel(); panel.setLayout(new BorderLayout()); renderer = new JLabel(); colourPanel = new javax.swing.JPanel(); renderer = new javax.swing.JLabel(); blank2 = new javax.swing.JPanel(); blank1 = new javax.swing.JPanel(); panel.add(renderer, BorderLayout.CENTER); blank2.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); blank2.setPreferredSize(new Dimension(20, 2)); colourPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, false)); colourPanel.setPreferredSize(new Dimension(12, 12)); blank2.add(colourPanel); panel.add(blank2, BorderLayout.WEST); }
private JPanel getSelectedRobotsPanel() { if (selectedRobotsPanel == null) { selectedRobotsPanel = new JPanel(); selectedRobotsPanel.setLayout(new BorderLayout()); selectedRobotsPanel.setPreferredSize(new Dimension(120, 100)); selectedRobotsPanel.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Selected Robots")); selectedRobotsPanel.add(getSelectedRobotsScrollPane(), BorderLayout.CENTER); } return selectedRobotsPanel; }
public PartDelPanel() { JPanel infoPanel = new JPanel(); manufacturer.removeAllItems(); manufacturer.addItem("ARS"); manufacturer.addItem("MOD"); manufacturer.addItem("BEH"); manufacturer.addItem("DAN"); infoPanel.setLayout(new GridLayout(2, 2)); infoPanel.setPreferredSize(new Dimension(500, 100)); infoPanel.add(new JLabel("Select a Manufacturer: ")); infoPanel.add(manufacturer); infoPanel.add(new JLabel("Enter Part Number to DELETE: ")); infoPanel.add(pNumBox); JPanel botPanel = new JPanel(); JButton delBut = new JButton("Delete"); delBut.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { int m = 0; String manu = (String) manufacturer.getSelectedItem(); if (manu.equals("ARS")) m = PartOperations.mARS; if (manu.equals("BEH")) m = PartOperations.mBEH; if (manu.equals("MOD")) m = PartOperations.mMOD; if (manu.equals("DAN")) m = PartOperations.mDAN; String pnum = pNumBox.getText(); PartOperations.delPart(con, m, pnum); } }); JButton resBut = new JButton("Reset"); resBut.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { pNumBox.setText(""); } }); JButton cancelBut = new JButton("Cancel"); cancelBut.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { PartModPanel.frameDel.dispose(); } }); botPanel.add(delBut); botPanel.add(resBut); botPanel.add(cancelBut); botPanel.add(warning); add(infoPanel, BorderLayout.NORTH); add(botPanel, BorderLayout.SOUTH); }
private void createPropertiesPanel() { myPropertiesPanel = new JPanel(new BorderLayout()); final JPanel emptyPanel = new JPanel(); emptyPanel.setMinimumSize(JBUI.emptySize()); emptyPanel.setPreferredSize(JBUI.emptySize()); myPropertiesPanelWrapper = new JPanel(new CardLayout()); myPropertiesPanel.setBorder(new CustomLineBorder(1, 0, 0, 0)); myPropertiesPanelWrapper.add(EMPTY_CARD, emptyPanel); myPropertiesPanelWrapper.add(PROPERTIES_CARD, myPropertiesPanel); }
public DatePicker(JFrame parent) { d = new JDialog(); d.setModal(true); String[] header = {"Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"}; JPanel p1 = new JPanel(new GridLayout(7, 7)); p1.setPreferredSize(new Dimension(430, 120)); for (int x = 0; x < button.length; x++) { final int selection = x; button[x] = new JButton(); button[x].setFocusPainted(false); button[x].setBackground(Color.white); if (x > 6) button[x].addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { day = button[selection].getActionCommand(); d.dispose(); } }); if (x < 7) { button[x].setText(header[x]); button[x].setForeground(Color.red); } p1.add(button[x]); } JPanel p2 = new JPanel(new GridLayout(1, 3)); JButton previous = new JButton("<< Previous"); previous.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { month--; displayDate(); } }); p2.add(previous); p2.add(l); JButton next = new JButton("Next >>"); next.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { month++; displayDate(); } }); p2.add(next); d.add(p1, BorderLayout.CENTER); d.add(p2, BorderLayout.SOUTH); d.pack(); d.setLocationRelativeTo(parent); displayDate(); d.setVisible(true); }