Java Code Examples for com.alee.laf.button.WebButton#setMargin()
The following examples show how to use
com.alee.laf.button.WebButton#setMargin() .
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: 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 2
Source File: TabPanelBots.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void initializeUI() { uiDone = true; // Prepare title label. WebPanel titlePanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); WebLabel titleLabel = new WebLabel(Msg.getString("TabPanelBots.title"), WebLabel.CENTER); //$NON-NLS-1$ titleLabel.setFont(new Font("Serif", Font.BOLD, 16)); titlePanel.add(titleLabel); topContentPanel.add(titlePanel); // Create crew count panel WebPanel crewCountPanel = new WebPanel(new GridLayout(2, 1, 0, 0)); // crewCountPanel.setBorder(new MarsPanelBorder()); topContentPanel.add(crewCountPanel); // Create crew num label crewNumCache = crewable.getRobotCrewNum(); crewNumLabel = new WebLabel(Msg.getString("TabPanelBots.crew", crewNumCache), WebLabel.CENTER); //$NON-NLS-1$ crewCountPanel.add(crewNumLabel); // Create crew capacity label crewCapacityCache = crewable.getRobotCrewCapacity(); crewCapLabel = new WebLabel(Msg.getString("TabPanelBots.crewCapacity", crewCapacityCache), WebLabel.CENTER); //$NON-NLS-1$ crewCountPanel.add(crewCapLabel); // Create crew display panel WebPanel crewDisplayPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); // crewDisplayPanel.setBorder(new MarsPanelBorder()); topContentPanel.add(crewDisplayPanel); // Create scroll panel for crew list. WebScrollPane crewScrollPanel = new WebScrollPane(); crewScrollPanel.setPreferredSize(new Dimension(175, 100)); crewDisplayPanel.add(crewScrollPanel); // Create crew list model crewListModel = new DefaultListModel<Robot>(); //crewListModel = new DefaultListModel<Unit>(); crewCache = crewable.getRobotCrew(); //crewCache = crewable.getUnitCrew(); Iterator<Robot> i = crewCache.iterator(); //Iterator<Unit> i = crewCache.iterator(); while (i.hasNext()) crewListModel.addElement(i.next()); // Create crew list crewList = new JList<Robot>(crewListModel); //crewList = new JList<Unit>(crewListModel); crewList.addMouseListener(this); crewScrollPanel.setViewportView(crewList); // Create crew 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$ crewDisplayPanel.add(monitorButton); }
Example 3
Source File: TabPanelCrew.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void initializeUI() { uiDone = true; // Prepare title label. WebPanel titlePanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); WebLabel titleLabel = new WebLabel(Msg.getString("TabPanelCrew.title"), WebLabel.CENTER); //$NON-NLS-1$ titleLabel.setFont(new Font("Serif", Font.BOLD, 16)); titlePanel.add(titleLabel); topContentPanel.add(titlePanel); // Create crew count panel WebPanel crewCountPanel = new WebPanel(new GridLayout(2, 1, 0, 0)); // crewCountPanel.setBorder(new MarsPanelBorder()); topContentPanel.add(crewCountPanel); // Create crew num label crewNumCache = crewable.getCrewNum(); crewNumLabel = new WebLabel(Msg.getString("TabPanelCrew.crew", crewNumCache), WebLabel.CENTER); //$NON-NLS-1$ crewCountPanel.add(crewNumLabel); // Create crew capacity label crewCapacityCache = crewable.getCrewCapacity(); crewCapLabel = new WebLabel(Msg.getString("TabPanelCrew.crewCapacity", crewCapacityCache), WebLabel.CENTER); //$NON-NLS-1$ crewCountPanel.add(crewCapLabel); // Create crew display panel WebPanel crewDisplayPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT)); // crewDisplayPanel.setBorder(new MarsPanelBorder()); topContentPanel.add(crewDisplayPanel); // Create scroll panel for crew list. WebScrollPane crewScrollPanel = new WebScrollPane(); crewScrollPanel.setPreferredSize(new Dimension(175, 200)); crewDisplayPanel.add(crewScrollPanel); // Create crew list model crewListModel = new DefaultListModel<Person>(); //crewListModel = new DefaultListModel<Unit>(); crewCache = crewable.getCrew(); //crewCache = crewable.getUnitCrew(); Iterator<Person> i = crewCache.iterator(); //Iterator<Unit> i = crewCache.iterator(); while (i.hasNext()) crewListModel.addElement(i.next()); // Create crew list crewList = new JList<Person>(crewListModel); //crewList = new JList<Unit>(crewListModel); crewList.addMouseListener(this); crewScrollPanel.setViewportView(crewList); // Create crew 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("TabPanelCrew.tooltip.monitor")); //$NON-NLS-1$ crewDisplayPanel.add(monitorButton); }
Example 4
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 5
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); }
Example 6
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); }