Java Code Examples for com.alee.laf.panel.WebPanel#add()
The following examples show how to use
com.alee.laf.panel.WebPanel#add() .
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: MainFrame.java From desktopclient-java with GNU General Public License v3.0 | 6 votes |
private void showAboutDialog() { WebPanel aboutPanel = new WebPanel(new GridLayout(0, 1, View.GAP_SMALL, View.GAP_SMALL)); aboutPanel.add(new WebLabel("Kontalk Java Client v" + Kontalk.VERSION)); WebLinkLabel linkLabel = new WebLinkLabel(); linkLabel.setLink(View.KONTALK_SITE); linkLabel.setText(Tr.tr("Visit kontalk.org")); aboutPanel.add(linkLabel); WebLabel soundLabel = new WebLabel(Tr.tr("Notification sound by")+" FxProSound"); aboutPanel.add(soundLabel); Icon icon = Utils.getIcon("kontalk.png"); WebOptionPane.showMessageDialog(this, aboutPanel, Tr.tr("About"), WebOptionPane.INFORMATION_MESSAGE, icon); }
Example 2
Source File: ShortcutInfoPanel.java From lnk2pwn with MIT License | 5 votes |
private WebPanel createArgumentsPanel() { MigLayout layout = new MigLayout("", "[grow]", ""); WebPanel panel = new WebPanel(); panel.setLayout(layout); panel.add(new WebLabel("Arguments"), "wrap"); panel.add(argumentsField, "grow"); return panel; }
Example 3
Source File: ShortcutInfoPanel.java From lnk2pwn with MIT License | 5 votes |
private WebPanel createTargetPathAndWorkingDirPanel() { MigLayout layout = new MigLayout("", "[grow][grow]", ""); WebPanel panel = new WebPanel(); panel.setLayout(layout); panel.add(new WebLabel("Target Path")); panel.add(new WebLabel("Working Dir"), "wrap"); panel.add(targetPathField, "grow"); panel.add(workingDirField, "grow"); return panel; }
Example 4
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 5
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 6
Source File: BuildingPanelResearch.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param lab the research building this panel is for. * @param desktop The main desktop. */ public BuildingPanelResearch(Research lab, MainDesktopPane desktop) { // Use BuildingFunctionPanel constructor super(lab.getBuilding(), desktop); // Initialize data members this.lab = lab; // Set panel layout setLayout(new BorderLayout()); // Prepare label panel WebPanel labelPanel = new WebPanel(new GridLayout(4, 1, 0, 0)); add(labelPanel, BorderLayout.NORTH); labelPanel.setOpaque(false); labelPanel.setBackground(new Color(0,0,0,128)); // Prepare research label WebLabel researchLabel = new WebLabel(Msg.getString("BuildingPanelResearch.title"), WebLabel.CENTER); //$NON-NLS-1$ researchLabel.setFont(new Font("Serif", Font.BOLD, 16)); //researchLabel.setForeground(new Color(102, 51, 0)); // dark brown labelPanel.add(researchLabel); // Prepare researcher number label researchersCache = lab.getResearcherNum(); researchersLabel = new WebLabel(Msg.getString("BuildingPanelResearch.numberOfResearchers", researchersCache), WebLabel.CENTER); labelPanel.add(researchersLabel); // Prepare researcher capacityLabel WebLabel researcherCapacityLabel = new WebLabel(Msg.getString("BuildingPanelResearch.researcherCapacity", lab.getLaboratorySize()), WebLabel.CENTER); labelPanel.add(researcherCapacityLabel); // Prepare specialties label WebLabel specialtiesLabel = new WebLabel(Msg.getString("BuildingPanelResearch.namesOfSpecialties"), WebLabel.CENTER); labelPanel.add(specialtiesLabel); // Get the research specialties of the building. ScienceType[] specialties = lab.getTechSpecialties(); int size = specialties.length; WebTextArea specialtyTA = new WebTextArea(); specialtyTA.setEditable(false); specialtyTA.setFont(new Font("SansSerif", Font.ITALIC, 12)); specialtyTA.setColumns(7); // 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"); } WebPanel listPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); listPanel.add(specialtyTA); specialtyTA.setBorder(new MarsPanelBorder()); add(listPanel, BorderLayout.CENTER); listPanel.setOpaque(false); listPanel.setBackground(new Color(0,0,0,128)); }
Example 7
Source File: BiologyStudyFieldMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * * @param desktop the main desktop pane. */ public BiologyStudyFieldMissionCustomInfoPanel(MainDesktopPane desktop) { // Use MissionCustomInfoPanel constructor. super(); // Initialize data members. this.desktop = desktop; // Set layout. setLayout(new BorderLayout()); // Create content panel. WebPanel contentPanel = new WebPanel(new GridLayout(3, 1)); add(contentPanel, BorderLayout.NORTH); // Create study panel. WebPanel studyPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentPanel.add(studyPanel); // Create science tool button. WebButton scienceToolButton = new WebButton(ImageLoader.getIcon(Msg.getString("img.science"))); //$NON-NLS-1$ scienceToolButton.setMargin(new Insets(1, 1, 1, 1)); scienceToolButton .setToolTipText(Msg.getString("BiologyStudyFieldMissionCustomInfoPanel.tooltip.openInScienceTool")); //$NON-NLS-1$ scienceToolButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { displayStudyInScienceTool(); } }); studyPanel.add(scienceToolButton); // Create study title label. WebLabel studyTitleLabel = new WebLabel( Msg.getString("BiologyStudyFieldMissionCustomInfoPanel.biologyFieldStudy")); //$NON-NLS-1$ studyPanel.add(studyTitleLabel); // Create study name label. studyNameLabel = new WebLabel(""); //$NON-NLS-1$ studyPanel.add(studyNameLabel); // Create researcher panel. WebPanel researcherPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentPanel.add(researcherPanel); // Create researcher title label. WebLabel researcherTitleLabel = new WebLabel( Msg.getString("BiologyStudyFieldMissionCustomInfoPanel.leadResearcher")); //$NON-NLS-1$ researcherPanel.add(researcherTitleLabel); // Create researcher name label. researcherNameLabel = new WebLabel(""); //$NON-NLS-1$ researcherPanel.add(researcherNameLabel); // Create study research panel. WebPanel studyResearchPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentPanel.add(studyResearchPanel); // Create study research title label. WebLabel studyResearchTitleLabel = new WebLabel( Msg.getString("BiologyStudyFieldMissionCustomInfoPanel.researchCompletion")); //$NON-NLS-1$ studyResearchPanel.add(studyResearchTitleLabel); // Create study research progress bar. studyResearchBar = new WebProgressBar(0, 100); studyResearchBar.setStringPainted(true); studyResearchPanel.add(studyResearchBar); }
Example 8
Source File: MiningMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor * * @param desktop the main desktop. */ MiningMissionCustomInfoPanel(MainDesktopPane desktop) { // Use JPanel constructor super(); // Set the layout. setLayout(new BorderLayout()); // Initialize data members. this.desktop = desktop; // Create LUV panel. WebPanel luvPane = new WebPanel(new FlowLayout(FlowLayout.LEFT)); add(luvPane, BorderLayout.NORTH); // Create LUV label. WebLabel luvLabel = new WebLabel("Light Utility Vehicle: "); luvPane.add(luvLabel); // Create LUV button. luvButton = new WebButton(" "); luvButton.setVisible(false); luvButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Open window for light utility vehicle. LightUtilityVehicle luv = mission.getLightUtilityVehicle(); if (luv != null) getDesktop().openUnitWindow(luv, false); } }); luvPane.add(luvButton); // Create center panel. WebPanel centerPane = new WebPanel(new GridLayout(2, 1)); add(centerPane, BorderLayout.CENTER); // Create concentration panel. WebPanel concentrationPane = new WebPanel(new BorderLayout()); centerPane.add(concentrationPane); // Create concentration label. WebButton concentrationLabel = new WebButton("Mineral Concentrations at Site:"); concentrationPane.add(concentrationLabel, BorderLayout.NORTH); // Create concentration scroll panel. WebScrollPane concentrationScrollPane = new WebScrollPane(); concentrationScrollPane.setPreferredSize(new Dimension(-1, -1)); concentrationPane.add(concentrationScrollPane, BorderLayout.CENTER); // Create concentration table. concentrationTableModel = new ConcentrationTableModel(); WebTable concentrationTable = new WebTable(concentrationTableModel); concentrationTable.setDefaultRenderer(Double.class, new NumberCellRenderer(1)); concentrationScrollPane.setViewportView(concentrationTable); // Create excavation panel. WebPanel excavationPane = new WebPanel(new BorderLayout()); centerPane.add(excavationPane); // Create excavation label. WebLabel excavationLabel = new WebLabel("Minerals Excavated at Site:"); excavationPane.add(excavationLabel, BorderLayout.NORTH); // Create excavation scroll panel. WebScrollPane excavationScrollPane = new WebScrollPane(); excavationScrollPane.setPreferredSize(new Dimension(-1, -1)); excavationPane.add(excavationScrollPane, BorderLayout.CENTER); // Create excavation tabel. excavationTableModel = new ExcavationTableModel(); WebTable excavationTable = new WebTable(excavationTableModel); excavationTable.setDefaultRenderer(Double.class, new NumberCellRenderer(2)); excavationScrollPane.setViewportView(excavationTable); }
Example 9
Source File: StudyDetailPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor */ StudyDetailPanel(ScienceWindow scienceWindow) { // Use JPanel constructor. super(); setLayout(new BorderLayout()); setPreferredSize(new Dimension(425, -1)); JLabel titleLabel = new JLabel(Msg.getString("StudyDetailPanel.details"), JLabel.CENTER); //$NON-NLS-1$ add(titleLabel, BorderLayout.NORTH); Box mainPane = Box.createVerticalBox(); mainPane.setBorder(new MarsPanelBorder()); add(mainPane, BorderLayout.CENTER); JPanel infoPane = new JPanel(new BorderLayout());//FlowLayout(FlowLayout.LEFT,5,5));//GridLayout(2, 1, 0, 0)); infoPane.setBorder(new MarsPanelBorder()); infoPane.setAlignmentX(Component.LEFT_ALIGNMENT); mainPane.add(infoPane); JPanel topSpringPane = new JPanel(new SpringLayout());//new GridLayout(2, 2, 0, 0)); infoPane.add(topSpringPane, BorderLayout.NORTH); scienceHeader = new JLabel(Msg.getString("StudyDetailPanel.science"), JLabel.RIGHT); //$NON-NLS-1$ scienceFieldLabel = new JLabel("N/A", JLabel.LEFT); levelHeader = new JLabel(Msg.getString("StudyDetailPanel.level"), JLabel.RIGHT); //$NON-NLS-1$ levelLabel = new JLabel("N/A", JLabel.LEFT); phaseHeader = new JLabel(Msg.getString("StudyDetailPanel.phase"), JLabel.RIGHT); //$NON-NLS-1$ phaseLabel = new JLabel("N/A", JLabel.LEFT); topicHeader = new JLabel(" " + Msg.getString("StudyDetailPanel.topic") + " "); //$NON-NLS-1$ topSpringPane.add(scienceHeader); topSpringPane.add(scienceFieldLabel); topSpringPane.add(levelHeader); topSpringPane.add(levelLabel); topSpringPane.add(phaseHeader); topSpringPane.add(phaseLabel); WebStyledLabel noneLabel = new WebStyledLabel("{None:i;c(blue);background(grey)}"); // StyleId.styledlabelTag, noneLabel.setStyleId(StyleId.styledlabelShadow); // styledlabelTag topicPanel = new WebPanel(new BorderLayout()); topicPanel.add(topicHeader, BorderLayout.WEST); topicPanel.add(noneLabel); infoPane.add(topicPanel, BorderLayout.CENTER); // Prepare SpringLayout SpringUtilities.makeCompactGrid(topSpringPane, 3, 2, //rows, cols 5, 4, //initX, initY 30, 3); //xPad, yPad primaryResearcherPane = new ResearcherPanel(scienceWindow); primaryResearcherPane.setAlignmentX(Component.LEFT_ALIGNMENT); mainPane.add(primaryResearcherPane); collabResearcherPanes = new ResearcherPanel[3]; for (int x = 0; x < 3; x++) { collabResearcherPanes[x] = new ResearcherPanel(scienceWindow); collabResearcherPanes[x].setAlignmentX(Component.LEFT_ALIGNMENT); mainPane.add(collabResearcherPanes[x]); } // Add a vertical glue. mainPane.add(Box.createVerticalGlue()); }
Example 10
Source File: BuildingPanelInhabitable.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param inhabitable The inhabitable building this panel is for. * @param desktop The main desktop. */ public BuildingPanelInhabitable(LifeSupport inhabitable, MainDesktopPane desktop) { // Use BuildingFunctionPanel constructor super(inhabitable.getBuilding(), desktop); // Initialize data members. this.inhabitable = inhabitable; // Set panel layout setLayout(new BorderLayout()); // Create label panel WebPanel labelPanel = new WebPanel(new GridLayout(3, 1, 0, 0)); add(labelPanel, BorderLayout.NORTH); labelPanel.setOpaque(false); labelPanel.setBackground(new Color(0,0,0,128)); // Create inhabitant label WebLabel inhabitantLabel = new WebLabel(Msg.getString("BuildingPanelInhabitable.title"), WebLabel.CENTER); //$NON-NLS-1$ inhabitantLabel.setFont(new Font("Serif", Font.BOLD, 16)); //inhabitantLabel.setForeground(new Color(102, 51, 0)); // dark brown labelPanel.add(inhabitantLabel); inhabitantLabel.setOpaque(false); inhabitantLabel.setBackground(new Color(0,0,0,128)); // Create number label numberLabel = new WebLabel(Msg.getString("BuildingPanelInhabitable.number", inhabitable.getOccupantNumber()), WebLabel.CENTER); //$NON-NLS-1$ labelPanel.add(numberLabel); // numberLabel.setOpaque(false); // numberLabel.setBackground(new Color(0,0,0,128)); // Create capacity label WebLabel capacityLabel = new WebLabel( Msg.getString( "BuildingPanelInhabitable.capacity", //$NON-NLS-1$ inhabitable.getOccupantCapacity() ),WebLabel.CENTER ); labelPanel.add(capacityLabel); // capacityLabel.setOpaque(false); // capacityLabel.setBackground(new Color(0,0,0,128)); // Create inhabitant list panel WebPanel inhabitantListPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); add(inhabitantListPanel, BorderLayout.CENTER); // Create inhabitant list model inhabitantListModel = new DefaultListModel<Person>(); inhabitantCache = new ArrayList<Person>(inhabitable.getOccupants()); Iterator<Person> i = inhabitantCache.iterator(); while (i.hasNext()) inhabitantListModel.addElement(i.next()); // Create inhabitant list inhabitantList = new JList<Person>(inhabitantListModel); inhabitantList.addMouseListener(this); }
Example 11
Source File: TabPanelBots.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); WebLabel titleLabel = new WebLabel(Msg.getString("TabPanelBots.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 robot count panel WebPanel countPanel = new WebPanel(new GridLayout(3, 1, 0, 0)); // countPanel.setBorder(new MarsPanelBorder()); topContentPanel.add(countPanel); // Create robot num label robotNumCache = settlement.getNumBots(); robotNumLabel = new WebLabel(Msg.getString("TabPanelBots.associated", robotNumCache), WebLabel.CENTER); // $NON-NLS-1$ countPanel.add(robotNumLabel); // Create robot indoor label robotIndoorCache = settlement.getNumBots(); robotIndoorLabel = new WebLabel(Msg.getString("TabPanelBots.indoor", robotIndoorCache), WebLabel.CENTER); // $NON-NLS-1$ countPanel.add(robotIndoorLabel); // Create robot capacity label robotCapacityCache = settlement.getRobotCapacity(); robotCapLabel = new WebLabel(Msg.getString("TabPanelBots.capacity", robotCapacityCache), WebLabel.CENTER); // $NON-NLS-1$ countPanel.add(robotCapLabel); // Create spring layout robot display panel WebPanel robotDisplayPanel = new WebPanel(new SpringLayout());// FlowLayout(FlowLayout.LEFT)); // robotDisplayPanel.setBorder(new MarsPanelBorder()); topContentPanel.add(robotDisplayPanel); // Create scroll panel for robot list. robotScrollPanel = new WebScrollPane(); robotScrollPanel.setPreferredSize(new Dimension(120, 250)); robotDisplayPanel.add(robotScrollPanel); // Create robot list model robotListModel = new RobotListModel(settlement); // Create robot list robotList = new JList<Robot>(robotListModel); robotList.addMouseListener(this); robotScrollPanel.setViewportView(robotList); // Create robot monitor button WebButton monitorButton = new WebButton(ImageLoader.getIcon(Msg.getString("img.monitor"))); //$NON-NLS-1$ monitorButton.setMargin(new Insets(1, 1, 1, 1)); monitorButton.addActionListener(this); monitorButton.setToolTipText(Msg.getString("TabPanelBots.tooltip.monitor")); //$NON-NLS-1$ WebPanel buttonPane = new WebPanel(new FlowLayout(FlowLayout.CENTER)); // buttonPane.setPreferredSize(new Dimension(25, 25)); buttonPane.add(monitorButton); robotDisplayPanel.add(buttonPane); // Lay out the spring panel. SpringUtilities.makeCompactGrid(robotDisplayPanel, 2, 1, // rows, cols 30, 10, // initX, initY 10, 10); // xPad, yPad }
Example 12
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 13
Source File: BuildingPanelPower.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param building the building the panel is for. * @param desktop The main desktop. */ public BuildingPanelPower(Building building, MainDesktopPane desktop) { // Use BuildingFunctionPanel constructor super(building, desktop); // Check if the building is a power producer. isProducer = building.hasFunction(FunctionType.POWER_GENERATION); generator = building.getPowerGeneration(); // Set the layout setLayout(new BorderLayout()); // 2014-11-21 Changed font type, size and color and label text WebLabel titleLabel = new WebLabel( Msg.getString("BuildingPanelPower.title"), //$NON-NLS-1$ WebLabel.CENTER); titleLabel.setFont(new Font("Serif", Font.BOLD, 16)); //titleLabel.setForeground(new Color(102, 51, 0)); // dark brown add(titleLabel, BorderLayout.NORTH); WebPanel springPanel = new WebPanel(new SpringLayout()); add(springPanel, BorderLayout.CENTER); // Prepare power status label. powerStatusCache = building.getPowerMode(); powerStatusLabel = new WebLabel( Msg.getString("BuildingPanelPower.powerStatus"), //$NON-NLS-1$ WebLabel.RIGHT); springPanel.add(powerStatusLabel); WebPanel wrapper1 = new WebPanel(new FlowLayout(0, 0, FlowLayout.LEADING)); statusTF = new WebTextField(powerStatusCache.getName()); statusTF.setEditable(false); statusTF.setColumns(7); statusTF.setPreferredSize(new Dimension(120, 25)); wrapper1.add(statusTF); springPanel.add(wrapper1); // If power producer, prepare power producer label. if (isProducer) { //PowerGeneration generator = building.getPowerGeneration();//(PowerGeneration) building.getFunction(FunctionType.POWER_GENERATION); powerCache = generator.getGeneratedPower(); powerLabel = new WebLabel( Msg.getString("BuildingPanelPower.powerProduced"), //$NON-NLS-1$ WebLabel.RIGHT); springPanel.add(powerLabel); WebPanel wrapper2 = new WebPanel(new FlowLayout(0, 0, FlowLayout.LEADING)); producedTF = new WebTextField(formatter.format(powerCache) + kW); producedTF.setEditable(false); producedTF.setColumns(7); producedTF.setPreferredSize(new Dimension(120, 25)); wrapper2.add(producedTF); springPanel.add(wrapper2); } // Prepare power used label. if (powerStatusCache == PowerMode.FULL_POWER) usedCache = building.getFullPowerRequired(); else if (powerStatusCache == PowerMode.POWER_DOWN) usedCache = building.getPoweredDownPowerRequired(); else usedCache = 0D; usedLabel = new WebLabel( Msg.getString("BuildingPanelPower.powerUsed"), //$NON-NLS-1$ WebLabel.RIGHT ); springPanel.add(usedLabel); WebPanel wrapper3 = new WebPanel(new FlowLayout(0, 0, FlowLayout.LEADING)); usedTF = new WebTextField(formatter.format(usedCache) + kW); usedTF.setEditable(false); usedTF.setColumns(7); usedTF.setPreferredSize(new Dimension(120, 25)); wrapper3.add(usedTF); springPanel.add(wrapper3); //Lay out the spring panel. if (isProducer) { SpringUtilities.makeCompactGrid(springPanel, 3, 2, //rows, cols 75, 10, //initX, initY 3, 1); //xPad, yPad } else SpringUtilities.makeCompactGrid(springPanel, 2, 2, //rows, cols 75, 10, //initX, initY 3, 1); //xPad, yPad }
Example 14
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()); }
Example 15
Source File: TabPanelPopulation.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void initializeUI() { uiDone = true; JPanel titlePane = new JPanel(new FlowLayout(FlowLayout.CENTER)); topContentPanel.add(titlePane); JLabel heading = new JLabel(Msg.getString("TabPanelPopulation.title"), JLabel.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 population indoor label WebLabel populationIndoorHeader = new WebLabel(Msg.getString("TabPanelPopulation.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("TabPanelPopulation.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, 2, 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("TabPanelPopulation.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 JPanel populationDisplayPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); populationDisplayPanel.setBorder(title); topContentPanel.add(populationDisplayPanel); // Create scroll panel for population list. populationScrollPanel = new JScrollPane(); populationScrollPanel.setPreferredSize(new Dimension(200, 250)); populationDisplayPanel.add(populationScrollPanel); // Create population list model populationListModel = new PopulationListModel(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("TabPanelPopulation.tooltip.monitor")); //$NON-NLS-1$ populationDisplayPanel.add(monitorButton); }
Example 16
Source File: WebFileChooserPanel.java From weblaf with GNU General Public License v3.0 | 4 votes |
/** * Delete all selected in view files. */ public void deleteSelectedFiles () { final List<File> files = getAllSelectedFiles (); if ( files.isEmpty () ) { return; } final WebPanel all = new WebPanel ( new BorderLayout ( 0, 5 ) ); all.add ( new WebLabel ( "weblaf.filechooser.delete.confirm.text" ), BorderLayout.NORTH ); final VerticalFlowLayout removalListLayout = new VerticalFlowLayout ( VerticalFlowLayout.TOP, 0, 5, true, false ); final WebPanel deleteFilesPanel = new WebPanel ( StyleId.filechooserRemovalListPanel.at ( this ), removalListLayout ); for ( final File file : files ) { deleteFilesPanel.add ( new WebLabel ( file.getName (), FileUtils.getFileIcon ( file ), WebLabel.LEFT ) ); } final WebScrollPane scroll = new WebScrollPane ( deleteFilesPanel ) { @NotNull @Override public Dimension getPreferredSize () { final Dimension ps = super.getPreferredSize (); final JScrollBar vsb = getVerticalScrollBar (); if ( vsb != null && vsb.isShowing () ) { ps.width = ps.width + vsb.getPreferredSize ().width; } ps.height = Math.min ( ps.height, 100 ); return ps; } }; all.add ( scroll, BorderLayout.CENTER ); final int confirm = WebOptionPane.showConfirmDialog ( WebFileChooserPanel.this, all, LM.get ( "weblaf.filechooser.delete.confirm.title" ), WebOptionPane.YES_NO_OPTION, WebOptionPane.QUESTION_MESSAGE ); if ( confirm == WebOptionPane.YES_OPTION ) { FileUtils.deleteFiles ( files ); reloadCurrentFolder (); } }
Example 17
Source File: ModifyTransportItemDialog.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param owner the owner of this dialog. * @param title title of dialog. * @param transportItem the transport item to modify. */ public ModifyTransportItemDialog(MainDesktopPane desktop, ResupplyWindow resupplyWindow, String title, Transportable transportItem) {// , boolean isFX) { // Use ModalInternalFrame constructor super("Modify Mission"); // Initialize data members. this.transportItem = transportItem; this.resupplyWindow = resupplyWindow; this.setSize(560,500); // Create main panel WebPanel mainPane = new WebPanel(new BorderLayout()); setContentPane(mainPane); initEditingPanel(); mainPane.add(editingPanel, BorderLayout.CENTER); // Create the button pane. WebPanel buttonPane = new WebPanel(new FlowLayout(FlowLayout.CENTER, 10, 5)); mainPane.add(buttonPane, BorderLayout.SOUTH); // Create commit button. // Change button text from "Modify" to "Commit Changes" commitButton = new WebButton("Commit Changes"); commitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Modify transport item and close dialog. modifyTransportItem(); } }); buttonPane.add(commitButton); // Create cancel button. // Change button text from "Cancel" to "Discard Changes" WebButton cancelButton = new WebButton("Discard Changes"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { // Close dialog. dispose(); } }); buttonPane.add(cancelButton); // Add to its own tab pane // if (desktop.getMainScene() != null) // desktop.add(this); // //desktop.getMainScene().getDesktops().get(2).add(this); // else desktop.add(this); Dimension desktopSize = desktop.getParent().getSize(); Dimension jInternalFrameSize = this.getSize(); int width = (desktopSize.width - jInternalFrameSize.width) / 2; int height = (desktopSize.height - jInternalFrameSize.height) / 2; setLocation(width, height); setModal(true); setVisible(true); }
Example 18
Source File: NavigatorWindow.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Pops out a small panel for showing additional info * * @param landmark * @param event */ public void startPopOver(Landmark landmark, int x, int y, MouseEvent event) { // final WebPopup<?> popup = new WebPopup(desktop.getMainWindow().getMainPane()); // popup.setPadding(5); // popup.setResizable(false); // popup.setDraggable(true); // // final WebPanel container = new WebPanel(StyleId.panelTransparent, new BorderLayout(5, 5)); // // final WebLabel label = new WebLabel(landmark.getLandmarkLandingLocation(), WebLabel.CENTER); // container.add(label, BorderLayout.NORTH); // //// final String text = LM.get ( getExampleLanguagePrefix () + "text" ); //// final WebTextField field = new WebTextField ( text, 20 ); //// field.setHorizontalAlignment ( WebTextField.CENTER ); //// container.add ( field, BorderLayout.CENTER ); // // popup.add(container); // //// popup.pack(); // popup.showPopup(event.getComponent(), x + 5, y + 5); final WebPopOver popOver = new WebPopOver(desktop.getMainWindow().getMainPane()); // popOver.setIconImages (); popOver.setCloseOnFocusLoss(true); popOver.setPadding(2); popOver.setTitle(landmark.getLandmarkName()); final WebPanel c = new WebPanel(StyleId.panelTransparent, new BorderLayout(5,5)); final WebLabel l = new WebLabel(landmark.getLandmarkLandingLocation(), WebLabel.CENTER); c.add(l, BorderLayout.NORTH); // final String text = LM.get ( getExampleLanguagePrefix () + "text" ); // final WebTextField field = new WebTextField ( text, 20 ); // field.setHorizontalAlignment ( WebTextField.CENTER ); // container.add ( field, BorderLayout.CENTER ); popOver.add(c); popOver.show(event.getComponent(), x + 5, y + 5, PopOverDirection.down); }
Example 19
Source File: MeteorologyStudyFieldMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * * @param desktop the main desktop pane. */ public MeteorologyStudyFieldMissionCustomInfoPanel(MainDesktopPane desktop) { // Use MissionCustomInfoPanel constructor. super(); // Initialize data members. this.desktop = desktop; // Set layout. setLayout(new BorderLayout()); // Create content panel. WebPanel contentPanel = new WebPanel(new GridLayout(3, 1)); add(contentPanel, BorderLayout.NORTH); // Create study panel. WebPanel studyPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentPanel.add(studyPanel); // Create science tool button. WebButton scienceToolButton = new WebButton(ImageLoader.getIcon(Msg.getString("img.science"))); //$NON-NLS-1$ scienceToolButton.setMargin(new Insets(1, 1, 1, 1)); scienceToolButton .setToolTipText(Msg.getString("MeteorologyStudyFieldMissionCustomInfoPanel.tooltip.openInScienceTool")); //$NON-NLS-1$ scienceToolButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { displayStudyInScienceTool(); } }); studyPanel.add(scienceToolButton); // Create study title label. WebLabel studyTitleLabel = new WebLabel( Msg.getString("MeteorologyStudyFieldMissionCustomInfoPanel.meteorologyFieldStudy")); //$NON-NLS-1$ studyPanel.add(studyTitleLabel); // Create study name label. studyNameLabel = new WebLabel(""); //$NON-NLS-1$ studyPanel.add(studyNameLabel); // Create researcher panel. WebPanel researcherPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentPanel.add(researcherPanel); // Create researcher title label. WebLabel researcherTitleLabel = new WebLabel( Msg.getString("MeteorologyStudyFieldMissionCustomInfoPanel.leadResearcher")); //$NON-NLS-1$ researcherPanel.add(researcherTitleLabel); // Create researcher name label. researcherNameLabel = new WebLabel(""); //$NON-NLS-1$ researcherPanel.add(researcherNameLabel); // Create study research panel. WebPanel studyResearchPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentPanel.add(studyResearchPanel); // Create study research title label. WebLabel studyResearchTitleLabel = new WebLabel( Msg.getString("MeteorologyStudyFieldMissionCustomInfoPanel.researchCompletion")); //$NON-NLS-1$ studyResearchPanel.add(studyResearchTitleLabel); // Create study research progress bar. studyResearchBar = new WebProgressBar(0, 100); studyResearchBar.setStringPainted(true); studyResearchPanel.add(studyResearchBar); }
Example 20
Source File: AreologyStudyFieldMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param desktop the main desktop pane. */ public AreologyStudyFieldMissionCustomInfoPanel(MainDesktopPane desktop) { // Use MissionCustomInfoPanel constructor. super(); // Initialize data members. this.desktop = desktop; // Set layout. setLayout(new BorderLayout()); // Create content panel. WebPanel contentPanel = new WebPanel(new GridLayout(3, 1)); add(contentPanel, BorderLayout.NORTH); // Create study panel. WebPanel studyPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentPanel.add(studyPanel); // Create science tool button. WebButton scienceToolButton = new WebButton(ImageLoader.getIcon(Msg.getString("img.science"))); //$NON-NLS-1$ scienceToolButton.setMargin(new Insets(1, 1, 1, 1)); scienceToolButton.setToolTipText(Msg.getString("AreologyStudyFieldMissionCustomInfoPanel.tooltip.openInScienceTool")); //$NON-NLS-1$ scienceToolButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { displayStudyInScienceTool(); } }); studyPanel.add(scienceToolButton); // Create study title label. WebLabel studyTitleLabel = new WebLabel(Msg.getString("AreologyStudyFieldMissionCustomInfoPanel.areologyFieldStudy")); //$NON-NLS-1$ studyPanel.add(studyTitleLabel); // Create study name label. studyNameLabel = new WebLabel(""); //$NON-NLS-1$ studyPanel.add(studyNameLabel); // Create researcher panel. WebPanel researcherPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentPanel.add(researcherPanel); // Create researcher title label. WebLabel researcherTitleLabel = new WebLabel(Msg.getString("AreologyStudyFieldMissionCustomInfoPanel.leadResearcher")); //$NON-NLS-1$ researcherPanel.add(researcherTitleLabel); // Create researcher name label. researcherNameLabel = new WebLabel(""); //$NON-NLS-1$ researcherPanel.add(researcherNameLabel); // Create study research panel. WebPanel studyResearchPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); contentPanel.add(studyResearchPanel); // Create study research title label. WebLabel studyResearchTitleLabel = new WebLabel(Msg.getString("AreologyStudyFieldMissionCustomInfoPanel.researchCompletion")); //$NON-NLS-1$ studyResearchPanel.add(studyResearchTitleLabel); // Create study research progress bar. studyResearchBar = new WebProgressBar(0, 100); studyResearchBar.setStringPainted(true); studyResearchPanel.add(studyResearchBar); }