Java Code Examples for com.alee.laf.panel.WebPanel#setBorder()
The following examples show how to use
com.alee.laf.panel.WebPanel#setBorder() .
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: BrowserJFX.java From mars-sim with GNU General Public License v3.0 | 6 votes |
/** * Sets up the Web Panel */ public WebPanel initWebPanel() { progressBar.setPreferredSize(new Dimension(150, 18)); progressBar.setStringPainted(true); WebPanel statusBar = new WebPanel(new BorderLayout(5, 0)); statusBar.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); statusBar.add(statusBarLbl, BorderLayout.CENTER); statusBar.add(progressBar, BorderLayout.EAST); //panel.add(topBar, BorderLayout.NORTH); panel.add(jfxPanel, BorderLayout.CENTER); panel.add(statusBar, BorderLayout.SOUTH); return panel; }
Example 2
Source File: NotesTabPanel.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public void initializeUI() { uiDone = true; // Initialize location header. WebPanel titlePane = new WebPanel(new FlowLayout(FlowLayout.CENTER)); topContentPanel.add(titlePane); WebLabel titleLabel = new WebLabel(Msg.getString("NotesTabPanel.title"), WebLabel.CENTER); //$NON-NLS-1$ titleLabel.setFont(new Font("Serif", Font.BOLD, 16)); // titleLabel.setForeground(new Color(102, 51, 0)); // dark brown titlePane.add(titleLabel); // Create notes panel WebPanel notesPanel = new WebPanel(new BorderLayout(5, 5)); notesPanel.setBorder(new MarsPanelBorder()); notesPanel.setBorder(new EmptyBorder(1, 1, 1, 1)); centerContentPanel.add(notesPanel); notesCache = unit.getNotes(); textArea = new WebTextArea(StyleId.textareaDecorated); notesPanel.add(textArea); if (notesCache == null || notesCache.equals("")) textArea.setInputPrompt("Enter Here"); else { textArea.append(notesCache); } }
Example 3
Source File: ScienceWindow.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * Constructor * @param desktop the main desktop panel. */ public ScienceWindow(MainDesktopPane desktop) { // Use ToolWindow constructor super(NAME, desktop); selectedStudy = null; // Create content panel. WebPanel mainPane = new WebPanel(new BorderLayout()); mainPane.setBorder(MainDesktopPane.newEmptyBorder()); setContentPane(mainPane); // Create lists panel. WebPanel listsPane = new WebPanel(new GridLayout(2, 1)); mainPane.add(listsPane, BorderLayout.WEST); // Create ongoing study list panel. ongoingStudyListPane = new OngoingStudyListPanel(this); listsPane.add(ongoingStudyListPane); // Create finished study list panel. finishedStudyListPane = new FinishedStudyListPanel(this); listsPane.add(finishedStudyListPane); // Create study detail panel. studyDetailPane = new StudyDetailPanel(this); mainPane.add(studyDetailPane, BorderLayout.CENTER); //if (desktop.getMainScene() != null) //setClosable(false); setMinimumSize(new Dimension(480, 480)); setMaximizable(true); setResizable(false); setVisible(true); // Pack window. pack(); }
Example 4
Source File: TabPanelAssociatedPeople.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void initializeUI() { uiDone = true; WebPanel titlePane = new WebPanel(new FlowLayout(FlowLayout.CENTER)); topContentPanel.add(titlePane); // Create associated people label WebLabel heading = new WebLabel(Msg.getString("TabPanelAssociatedPeople.title"), WebLabel.CENTER); //$NON-NLS-1$ heading.setFont(new Font("Serif", Font.BOLD, 16)); // heading.setForeground(new Color(102, 51, 0)); // dark brown titlePane.add(heading); // Prepare count spring layout panel. WebPanel countPanel = new WebPanel(new SpringLayout());//GridLayout(3, 1, 0, 0)); // countPanel.setBorder(new MarsPanelBorder()); topContentPanel.add(countPanel); // Create associate label WebLabel populationNumHeader = new WebLabel(Msg.getString("TabPanelAssociatedPeople.associated"), WebLabel.RIGHT); // $NON-NLS-1$ countPanel.add(populationNumHeader); populationCitizensCache = settlement.getNumCitizens(); populationCitizensLabel = new WebLabel(populationCitizensCache + "", WebLabel.LEFT); countPanel.add(populationCitizensLabel); // Create population indoor label WebLabel populationIndoorHeader = new WebLabel(Msg.getString("TabPanelAssociatedPeople.indoor"), WebLabel.RIGHT); // $NON-NLS-1$ countPanel.add(populationIndoorHeader); populationIndoorCache = settlement.getIndoorPeopleCount(); populationIndoorLabel = new WebLabel(populationIndoorCache + "", WebLabel.LEFT); countPanel.add(populationIndoorLabel); // Create population capacity label WebLabel populationCapacityHeader = new WebLabel(Msg.getString("TabPanelAssociatedPeople.capacity"), WebLabel.RIGHT); // $NON-NLS-1$ countPanel.add(populationCapacityHeader); populationCapacityCache = settlement.getPopulationCapacity(); populationCapacityLabel = new WebLabel(populationCapacityCache + "", WebLabel.RIGHT); countPanel.add(populationCapacityLabel); // Lay out the spring panel. SpringUtilities.makeCompactGrid(countPanel, 3, 2, // rows, cols 25, 10, // initX, initY 10, 10); // xPad, yPad UIManager.getDefaults().put("TitledBorder.titleColor", Color.darkGray); Border lowerEtched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); TitledBorder title = BorderFactory.createTitledBorder(lowerEtched, " " + Msg.getString("TabPanelAssociatedPeople.title") + " "); // title.setTitleJustification(TitledBorder.RIGHT); Font titleFont = UIManager.getFont("TitledBorder.font"); title.setTitleFont( titleFont.deriveFont(Font.ITALIC + Font.BOLD)); // Create spring layout population display panel WebPanel populationDisplayPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); populationDisplayPanel.setBorder(title); // populationDisplayPanel.setBorder(new MarsPanelBorder()); topContentPanel.add(populationDisplayPanel); // Create scroll panel for population list. populationScrollPanel = new WebScrollPane(); populationScrollPanel.setPreferredSize(new Dimension(200, 250)); populationDisplayPanel.add(populationScrollPanel); // Create population list model populationListModel = new AssociatedPopulationListModel(settlement); // Create population list populationList = new JList<Person>(populationListModel); populationList.addMouseListener(this); populationScrollPanel.setViewportView(populationList); // Create population monitor button JButton monitorButton = new JButton(ImageLoader.getIcon(Msg.getString("img.monitor"))); //$NON-NLS-1$ monitorButton.setMargin(new Insets(1, 1, 1, 1)); monitorButton.addActionListener(this); monitorButton.setToolTipText(Msg.getString("TabPanelAssociatedPeople.tooltip.monitor")); //$NON-NLS-1$ populationDisplayPanel.add(monitorButton); // WebPanel buttonPane = new WebPanel(new FlowLayout(FlowLayout.RIGHT)); //// buttonPane.setPreferredSize(new Dimension(25, 25)); // buttonPane.add(monitorButton); // // populationDisplayPanel.add(buttonPane); }
Example 5
Source File: LaboratoryTabPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void initializeUI() { uiDone = true; Lab lab = rover.getLab(); // Prepare laboratory panel WebPanel laboratoryPanel = new WebPanel(new BorderLayout()); topContentPanel.add(laboratoryPanel); // Prepare name panel WebPanel titlePanel = new WebPanel(); laboratoryPanel.add(titlePanel, BorderLayout.NORTH); // Prepare laboratory label WebLabel titleLabel = new WebLabel("Laboratory", WebLabel.CENTER); titleLabel.setFont(new Font("Serif", Font.BOLD, 16)); titlePanel.add(titleLabel); // Prepare the top panel using spring layout. WebPanel springPanel = new WebPanel(new SpringLayout()); // springPanel.setPadding(10, 0, 0, 0); laboratoryPanel.add(springPanel, BorderLayout.CENTER); // Prepare label panel // WebPanel labelPanel = new WebPanel(new GridLayout(3, 1)); // laboratoryPanel.add(labelPanel, BorderLayout.CENTER); // Prepare researcher number label WebLabel headerLabel0 = new WebLabel("Number of Researchers : ", WebLabel.CENTER); springPanel.add(headerLabel0); researchersCache = lab.getResearcherNum(); researchersLabel = new WebLabel("" + researchersCache, WebLabel.CENTER); springPanel.add(researchersLabel); // Prepare researcher capacityLabel WebLabel headerLabel1 = new WebLabel("Researcher Capacity : ", WebLabel.CENTER); springPanel.add(headerLabel1); WebLabel researcherCapacityLabel = new WebLabel("" + lab.getLaboratorySize(), WebLabel.CENTER); springPanel.add(researcherCapacityLabel); // Lay out the spring panel. SpringUtilities.makeCompactGrid(springPanel, 2, 2, //rows, cols 90, 10, //initX, initY 10, 4); //xPad, yPad // Get the research specialties of the building. ScienceType[] specialties = lab.getTechSpecialties(); int size = specialties.length; // Prepare specialty text area WebTextArea specialtyTA = new WebTextArea(); specialtyTA.setEditable(false); specialtyTA.setFont(new Font("SansSerif", Font.ITALIC, 12)); specialtyTA.setColumns(10); // specialtyTA.setSize(100, 60); specialtyTA.setBorder(new MarsPanelBorder()); WebPanel listPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); listPanel.setSize(150, 80); listPanel.add(specialtyTA); TitledBorder titledBorder = BorderFactory.createTitledBorder(null, "Specialties", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new Font("Serif", Font.BOLD, 14), java.awt.Color.darkGray); listPanel.setBorder(titledBorder); // Prepare specialties label // WebLabel specialtiesLabel = new WebLabel("Specialties : ", WebLabel.CENTER); // listPanel.add(specialtiesLabel, BorderLayout.NORTH); laboratoryPanel.add(listPanel, BorderLayout.SOUTH); // For each specialty, add specialty name panel. for (ScienceType specialty : specialties) { specialtyTA.append(" " + specialty.getName()+ " "); if (!specialty.equals(specialties[size-1])) //if it's NOT the last one specialtyTA.append("\n"); } }
Example 6
Source File: TabPanelGeneral.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void createBigFive() { PersonalityTraitManager p = person.getMind().getTraitManager(); // int o = p.getPersonalityTrait(PersonalityTraitType.OPENNESS); // int c = p.getPersonalityTrait(PersonalityTraitType.CONSCIENTIOUSNESS); // int e = p.getPersonalityTrait(PersonalityTraitType.EXTRAVERSION); //getIntrovertExtrovertScore(); // int a = p.getPersonalityTrait(PersonalityTraitType.AGREEABLENESS); // int n = p.getPersonalityTrait(PersonalityTraitType.NEUROTICISM); String[] types = new String[5]; int[] scores = new int[5]; for (PersonalityTraitType t : PersonalityTraitType.values()) { types[t.ordinal()] = t.getName(); scores[t.ordinal()] = p.getPersonalityTrait(t); } // Prepare MBTI text area WebTextArea ta = new WebTextArea(); ta.setEditable(false); ta.setFont(new Font("Monospaced", Font.PLAIN, 12)); ta.setColumns(14); // specialtyTA.setSize(100, 60); ta.setBorder(new MarsPanelBorder()); WebPanel listPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); listPanel.setSize(110, 150); listPanel.add(ta); centerContentPanel.add(listPanel, BorderLayout.SOUTH); TitledBorder titledBorder = BorderFactory.createTitledBorder(null, "Personality scores based on Big Five", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new Font("Serif", Font.PLAIN, 12), java.awt.Color.darkGray); listPanel.setBorder(titledBorder); for (int i = 0; i < 5; i++) { // StringBuffer sb = new StringBuffer(); String s = types[i]; int size = 18 - s.length(); while (size > 0) { ta.append(" "); size--; } ta.append(" " + s + " : " + scores[i] + " "); if (i < 4) //if it's NOT the last one ta.append("\n"); } }
Example 7
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 8
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 9
Source File: EventFilter.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param model the event table model * @param desktop the main desktop */ public EventFilter(EventTableModel model, MainDesktopPane desktop) { // Use JInternalFrame constructor. super(Msg.getString("EventFilter.title"), false, true); //$NON-NLS-1$ // Initialize data members. this.model = model; // Prepare content pane WebPanel mainPane = new WebPanel(); mainPane.setLayout(new BorderLayout()); mainPane.setBorder(MainDesktopPane.newEmptyBorder()); setContentPane(mainPane); // Create category pane WebPanel categoryPane = new WebPanel(new GridLayout(5, 1)); categoryPane.setBorder(new MarsPanelBorder()); mainPane.add(categoryPane, BorderLayout.CENTER); // Create transport events checkbox. hazardCheck = new WebCheckBox(HistoricalEventCategory.HAZARD.getName()); hazardCheck.setSelected(model.getDisplayHazard()); hazardCheck.addActionListener(this); categoryPane.add(hazardCheck); // Create mechanical events checkbox. malfunctionCheck = new WebCheckBox(HistoricalEventCategory.MALFUNCTION.getName()); malfunctionCheck.setSelected(model.getDisplayMalfunction()); malfunctionCheck.addActionListener(this); categoryPane.add(malfunctionCheck); // Create medical events checkbox. medicalCheck = new WebCheckBox(HistoricalEventCategory.MEDICAL.getName()); medicalCheck.setSelected(model.getDisplayMedical()); medicalCheck.addActionListener(this); categoryPane.add(medicalCheck); // Create mission events checkbox. missionCheck = new WebCheckBox(HistoricalEventCategory.MISSION.getName()); missionCheck.setSelected(model.getDisplayMission()); missionCheck.addActionListener(this); categoryPane.add(missionCheck); // Create task events checkbox. taskCheck = new WebCheckBox(HistoricalEventCategory.TASK.getName()); taskCheck.setSelected(model.getDisplayTask()); taskCheck.addActionListener(this); categoryPane.add(taskCheck); // Create transport events checkbox. transportCheck = new WebCheckBox(HistoricalEventCategory.TRANSPORT.getName()); transportCheck.setSelected(model.getDisplayTransport()); transportCheck.addActionListener(this); categoryPane.add(transportCheck); pack(); desktop.add(this); }