Java Code Examples for com.alee.laf.panel.WebPanel#setMaximumSize()
The following examples show how to use
com.alee.laf.panel.WebPanel#setMaximumSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommanderWindow.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void createMissionPanel() { WebPanel panel = new WebPanel(new BorderLayout()); tabPane.add(MISSION_TAB, panel); policyMainPanel = new WebPanel(new BorderLayout()); panel.add(policyMainPanel, BorderLayout.NORTH); policyMainPanel.setPreferredSize(new Dimension(200, 125)); policyMainPanel.setMaximumSize(new Dimension(200, 125)); // Create a button panel WebPanel buttonPanel = new WebPanel(new GridLayout(4,1)); // buttonPanel.setPreferredSize(new Dimension(250, 120)); policyMainPanel.add(buttonPanel, BorderLayout.CENTER); buttonPanel.setBorder(BorderFactory.createTitledBorder("Trade With Other Settlements")); buttonPanel.setToolTipText("Select the trade policy with other settlements"); ButtonGroup group0 = new ButtonGroup(); ButtonGroup group1 = new ButtonGroup(); r0 = new JRadioButton("Can initiate Trading Mission", true); r1 = new JRadioButton("Cannot initiate Trading Mission"); // Set up initial conditions if (settlement.isMissionDisable(Trade.DEFAULT_DESCRIPTION)) { r0.setSelected(false); r1.setSelected(true); } else { r0.setSelected(true); r1.setSelected(false); } r2 = new JRadioButton("No Trading Missions from all settlements"); r3 = new JRadioButton(ALLOW); // Set up initial conditions boolean noTrading = true; if (settlement.isTradeMissionAllowedFromASettlement(settlement)) { List<Settlement> list = getOtherSettlements(); // List<Settlement> allowedSettlements = settlementMissionList.getCheckedValues(); for (Settlement s: list) { if (!settlement.isTradeMissionAllowedFromASettlement(s)) { noTrading = false; break; } } } WebLabel selectLabel = new WebLabel(" Choose :"); selectLabel.setMinimumSize(new Dimension(150, 25)); selectLabel.setPreferredSize(150, 25); innerPanel = new WebPanel(new BorderLayout()); innerPanel.add(selectLabel, BorderLayout.NORTH); // Set settlement check boxes settlementMissionList = new WebCheckBoxList<>(StyleId.checkboxlist, createModel(getOtherSettlements())); settlementMissionList.setVisibleRowCount(3); innerPanel.add(settlementMissionList, BorderLayout.CENTER); WebScrollPane = new WebScrollPane(innerPanel); WebScrollPane.setMaximumWidth(250); // mainPanel.add(WebScrollPane, BorderLayout.EAST); if (noTrading) { r2.setSelected(true); r3.setSelected(false); policyMainPanel.remove(WebScrollPane); policyMainPanel.add(emptyPanel, BorderLayout.EAST); // settlementMissionList.setEnabled(false); } else { r2.setSelected(false); r3.setSelected(true); r3.setText(ALLOW + SEE_RIGHT); policyMainPanel.remove(emptyPanel); policyMainPanel.add(WebScrollPane, BorderLayout.EAST); // settlementMissionList.setEnabled(true); } group0.add(r0); group0.add(r1); group1.add(r2); group1.add(r3); buttonPanel.add(r0); buttonPanel.add(r1); buttonPanel.add(r2); buttonPanel.add(r3); PolicyRadioActionListener actionListener = new PolicyRadioActionListener(); r0.addActionListener(actionListener); r1.addActionListener(actionListener); r2.addActionListener(actionListener); r3.addActionListener(actionListener); }
Example 2
Source File: TypePanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param wizard {@link CreateMissionWizard} the create mission wizard. */ @SuppressWarnings("unchecked") TypePanel(CreateMissionWizard wizard) { // Use WizardPanel constructor. super(wizard); this.wizard = wizard; missionManager = Simulation.instance().getMissionManager(); // Set the layout. setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // Set the border. setBorder(new MarsPanelBorder()); // Create the type info label. WebLabel typeInfoLabel = new WebLabel("Select Mission Type"); typeInfoLabel.setFont(typeInfoLabel.getFont().deriveFont(Font.BOLD)); typeInfoLabel.setAlignmentX(Component.LEFT_ALIGNMENT); add(typeInfoLabel); // Create the type panel. WebPanel typePane = new WebPanel(new FlowLayout(FlowLayout.LEFT)); typePane.setAlignmentX(Component.LEFT_ALIGNMENT); add(typePane); // Create the type label. WebLabel typeLabel= new WebLabel("Type: "); typePane.add(typeLabel); // Create the mission types. MissionType[] missionTypes = MissionDataBean.getMissionTypes(); // sortStringBubble(missionTypes); // MissionType[] displayMissionTypes = new MissionType[missionTypes.length]; List<String> types = new ArrayList<>(); int size = missionTypes.length; for (int i=0; i<size; i++) { types.add(missionTypes[i].getName()); } // displayMissionTypes[0] = ""; // System.arraycopy(missionTypes, 0, displayMissionTypes, 1, missionTypes.length); typeSelect = new JComboBoxMW<String>(); Iterator<String> k = types.iterator(); while (k.hasNext()) typeSelect.addItem(k.next()); typeSelect.setSelectedIndex(-1); typeSelect.addItemListener(this); typeSelect.setMaximumRowCount(typeSelect.getItemCount()); typePane.add(typeSelect); typePane.setMaximumSize(new Dimension(Short.MAX_VALUE, typeSelect.getPreferredSize().height)); // Add a vertical strut to separate the display. add(Box.createVerticalStrut(10)); // Create the description info label. descriptionInfoLabel = new WebLabel("Edit Mission Description (Optional)"); descriptionInfoLabel.setFont(descriptionInfoLabel.getFont().deriveFont(Font.BOLD)); descriptionInfoLabel.setAlignmentX(Component.LEFT_ALIGNMENT); descriptionInfoLabel.setEnabled(false); add(descriptionInfoLabel); // Create the description panel. WebPanel descriptionPane = new WebPanel(new FlowLayout(FlowLayout.LEFT)); descriptionPane.setAlignmentX(Component.LEFT_ALIGNMENT); add(descriptionPane); // Create the description label. descriptionLabel = new WebLabel("Description: "); descriptionLabel.setEnabled(false); descriptionPane.add(descriptionLabel); // Create the description text field. descriptionTF = new WebTextField(20); descriptionTF.setEnabled(false); descriptionPane.add(descriptionTF); descriptionPane.setMaximumSize(new Dimension(Short.MAX_VALUE, descriptionTF.getPreferredSize().height)); // Listen for changes in the text addChangeListener(descriptionTF, e -> { descriptionText = descriptionTF.getText(); // System.out.println("descriptionText: " + descriptionText); }); // Add a vertical glue. add(Box.createVerticalGlue()); }