Java Code Examples for com.alee.laf.panel.WebPanel#setPreferredSize()
The following examples show how to use
com.alee.laf.panel.WebPanel#setPreferredSize() .
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 |
/** * Constructor. * @param desktop {@link MainDesktopPane} the main desktop panel. */ public CommanderWindow(MainDesktopPane desktop) { // Use ToolWindow constructor super(NAME, desktop); person = GameManager.commanderPerson; settlement = person.getAssociatedSettlement(); // Create content panel. mainPane = new WebPanel(new BorderLayout()); mainPane.setBorder(MainDesktopPane.newEmptyBorder()); setContentPane(mainPane); // Create the mission list panel. // JPanel listPane = new JPanel(new BorderLayout()); // listPane.setPreferredSize(new Dimension(200, 200)); // mainPane.add(listPane, BorderLayout.WEST); WebPanel bottomPane = new WebPanel(new GridLayout(1, 4)); bottomPane.setPreferredSize(new Dimension(-1, 50)); mainPane.add(bottomPane, BorderLayout.SOUTH); // JPanel leadershipPane = new JPanel(new BorderLayout()); // leadershipPane.setPreferredSize(new Dimension(200, 50)); // bottomPane.add(leadershipPane); // JLabel leadershipLabel = new JLabel("Leadership Points : ", JLabel.RIGHT); // bottomPane.add(leadershipLabel); // leadershipPointsLabel = new JLabel("", JLabel.LEFT); // bottomPane.add(leadershipPointsLabel); // bottomPane.add(new JLabel()); // bottomPane.add(new JLabel()); // // leadershipPointsLabel.setText(commander.getLeadershipPoint() + ""); // Create the info tab panel. tabPane = new JTabbedPane(); mainPane.add(tabPane, BorderLayout.CENTER); createAgriculturePanel(); createEngineeringPanel(); createLeadershipPanel(); createLogisticPanel(); createMissionPanel(); createResourcePanel(); createSafetyPanel(); createSciencePanel(); setSize(new Dimension(640, 480)); setMaximizable(true); setResizable(false); setVisible(true); //pack(); Dimension desktopSize = desktop.getSize(); Dimension jInternalFrameSize = this.getSize(); int width = (desktopSize.width - jInternalFrameSize.width) / 2; int height = (desktopSize.height - jInternalFrameSize.height) / 2; setLocation(width, height); }
Example 2
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); }