Java Code Examples for com.alee.laf.label.WebLabel#LEFT
The following examples show how to use
com.alee.laf.label.WebLabel#LEFT .
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: EmergencySupplyMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 6 votes |
/** * Constructor. */ public EmergencySupplyMissionCustomInfoPanel() { // Use JPanel constructor super(); // Set the layout. setLayout(new BorderLayout()); // Create the emergency supplies label. WebLabel emergencySuppliesLabel = new WebLabel(Msg.getString("EmergencySupplyMissionCustomInfoPanel.emergencySupplies"), WebLabel.LEFT); //$NON-NLS-1$ add(emergencySuppliesLabel, BorderLayout.NORTH); // Create a scroll pane for the emergency supplies table. WebScrollPane emergencySuppliesScrollPane = new WebScrollPane(); emergencySuppliesScrollPane.setPreferredSize(new Dimension(-1, -1)); add(emergencySuppliesScrollPane, BorderLayout.CENTER); // Create the emergency supplies table and model. emergencySuppliesTableModel = new EmergencySuppliesTableModel(); WebTable emergencySuppliesTable = new WebTable(emergencySuppliesTableModel); emergencySuppliesScrollPane.setViewportView(emergencySuppliesTable); }
Example 2
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 3
Source File: TabPanelMaintenance.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * * @param building the building to display. */ public BuildingMaintenancePanel(Building building) { // User WebPanel constructor. super(); manager = building.getMalfunctionManager(); setLayout(new GridLayout(4, 1, 0, 0)); // setBorder(new MarsPanelBorder()); WebLabel buildingLabel = new WebLabel(building.getNickName(), WebLabel.LEFT); buildingLabel.setFont(new Font("Serif", Font.BOLD, 14)); add(buildingLabel); // Add wear condition cache and label. wearConditionCache = (int) Math.round(manager.getWearCondition()); wearConditionLabel = new WebLabel( Msg.getString("BuildingPanelMaintenance.wearCondition", wearConditionCache), WebLabel.CENTER); TooltipManager.setTooltip(wearConditionLabel, Msg.getString("BuildingPanelMaintenance.wear.toolTip"), TooltipWay.down); // wearConditionLabel.setMargin (4); // add(wearConditionLabel); WebPanel mainPanel = new WebPanel(new BorderLayout(0, 0)); add(mainPanel); lastCompletedCache = (int) (manager.getTimeSinceLastMaintenance() / 1000D); lastLabel = new WebLabel("Last completed : " + lastCompletedCache + " sols ago", WebLabel.LEFT); mainPanel.add(lastLabel, BorderLayout.WEST); // lastLabel.setToolTipText(getToolTipString()); TooltipManager.setTooltip(lastLabel, getToolTipString(), TooltipWay.down); // Prepare progress bar panel. WebPanel progressBarPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); // mainPanel.add(progressBarPanel, BorderLayout.CENTER); add(progressBarPanel); mainPanel.add(wearConditionLabel, BorderLayout.CENTER); // Prepare progress bar. JProgressBar progressBar = new JProgressBar(); progressBarModel = progressBar.getModel(); progressBar.setStringPainted(true); progressBar.setPreferredSize(new Dimension(240, 15)); progressBarPanel.add(progressBar); // Set initial value for progress bar. double completed = manager.getMaintenanceWorkTimeCompleted(); double total = manager.getMaintenanceWorkTime(); int percentDone = (int) (100D * (completed / total)); progressBarModel.setValue(percentDone); // Prepare parts label. Map<Integer, Integer> parts = manager.getMaintenanceParts(); partsLabel = new WebLabel(getPartsString(parts, false), WebLabel.CENTER); partsLabel.setPreferredSize(new Dimension(-1, -1)); add(partsLabel); TooltipManager.setTooltip(partsLabel, getPartsString(parts, false), TooltipWay.down); }
Example 4
Source File: TabPanelMaintenance.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * * @param malfunction the malfunction for the panel. * @param building the building the malfunction is in. */ public BuildingMalfunctionPanel(Malfunction malfunction, Building building) { // Use WebPanel constructor super(); // Initialize data members this.malfunction = malfunction; // Set layout and border. setLayout(new GridLayout(5, 1, 0, 0)); // setBorder(new MarsPanelBorder()); // Prepare the building label. WebLabel buildingLabel = new WebLabel(building.getNickName(), WebLabel.LEFT); buildingLabel.setFont(new Font("Serif", Font.BOLD, 14)); add(buildingLabel); // Prepare the malfunction label. malfunctionLabel = new WebLabel(malfunction.getName(), WebLabel.LEFT); malfunctionLabel.setForeground(Color.red); add(malfunctionLabel); workLabel = new WebLabel("", WebLabel.LEFT); // workLabel.setFont(new Font("Serif", Font.ITALIC, 12)); // workLabel.setForeground(Color.LIGHT_GRAY); // workLabel.setBackground(Color.DARK_GRAY); add(workLabel); // Progress bar panel. WebPanel progressBarPanel = new WebPanel(new BorderLayout(0, 0)); add(progressBarPanel, BorderLayout.CENTER); // Prepare progress bar. JProgressBar progressBar = new JProgressBar(); progressBarModel = progressBar.getModel(); progressBar.setStringPainted(true); progressBarPanel.add(progressBar, BorderLayout.CENTER); // Set initial value for repair progress bar. progressBarModel.setValue(0); // Prepare parts label. partsLabel = new WebLabel(getPartsString(malfunction.getRepairParts(), false), WebLabel.CENTER); partsLabel.setPreferredSize(new Dimension(-1, -1)); add(partsLabel); // Add tooltip. // setToolTipText(getToolTipString()); TooltipManager.setTooltip(this, getToolTipString(), TooltipWay.up); update(); }
Example 5
Source File: BuildingPanelStorage.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param storage the storage building function. * @param desktop the main desktop. */ public BuildingPanelStorage(Storage storage, MainDesktopPane desktop) { // Use BuildingFunctionPanel constructor super(storage.getBuilding(), desktop); setLayout(new BorderLayout(0, 0)); // Create storage label. WebLabel storageLabel = new WebLabel(Msg.getString("BuildingPanelStorage.title"), WebLabel.CENTER); storageLabel.setFont(new Font("Serif", Font.BOLD, 16)); //storageLabel.setForeground(new Color(102, 51, 0)); // dark brown WebPanel titlePanel = new WebPanel(new GridLayout(2,1,0,0)); add(titlePanel, BorderLayout.NORTH); titlePanel.add(storageLabel); titlePanel.setOpaque(false); titlePanel.setBackground(new Color(0,0,0,128)); WebLabel maxCapLabel = new WebLabel(Msg.getString("BuildingPanelStorage.maxCap"), WebLabel.CENTER); titlePanel.add(maxCapLabel); Map<Integer, Double> resourceStorage = storage.getResourceStorageCapacity(); // Create resource storage panel. WebPanel resourceStoragePanel = new WebPanel(new GridLayout(resourceStorage.size(), 2, 0, 0)); add(resourceStoragePanel, BorderLayout.CENTER); resourceStoragePanel.setOpaque(false); resourceStoragePanel.setBackground(new Color(0,0,0,128)); SortedSet<Integer> keys = new TreeSet<Integer>(resourceStorage.keySet()); for (Integer resource : keys) { // Create resource label. WebLabel resourceLabel = new WebLabel( Conversion.capitalize(ResourceUtil.findAmountResourceName(resource)) + ":", WebLabel.LEFT); resourceStoragePanel.add(resourceLabel); double capacity = resourceStorage.get(resource); WebLabel capacityLabel = new WebLabel((int) capacity + " kg", WebLabel.RIGHT); resourceStoragePanel.add(capacityLabel); } }
Example 6
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 7
Source File: TradeMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. */ public TradeMissionCustomInfoPanel() { // Use JPanel constructor super(); // Set the layout. setLayout(new GridLayout(3, 1)); // Create the selling goods panel. WebPanel sellingGoodsPane = new WebPanel(new BorderLayout()); add(sellingGoodsPane); // Create the selling goods label. WebLabel sellingGoodsLabel = new WebLabel("Goods to Sell:", WebLabel.LEFT); sellingGoodsPane.add(sellingGoodsLabel, BorderLayout.NORTH); // Create a scroll pane for the selling goods table. WebScrollPane sellingGoodsScrollPane = new WebScrollPane(); sellingGoodsScrollPane.setPreferredSize(new Dimension(-1, -1)); sellingGoodsPane.add(sellingGoodsScrollPane, BorderLayout.CENTER); // Create the selling goods table and model. sellingGoodsTableModel = new SellingGoodsTableModel(); WebTable sellingGoodsTable = new WebTable(sellingGoodsTableModel); sellingGoodsScrollPane.setViewportView(sellingGoodsTable); // Create the desired goods panel. WebPanel desiredGoodsPane = new WebPanel(new BorderLayout()); add(desiredGoodsPane); // Create the desired goods label panel. WebPanel desiredGoodsLabelPane = new WebPanel(new GridLayout(1, 2, 0, 0)); desiredGoodsPane.add(desiredGoodsLabelPane, BorderLayout.NORTH); // Create the desired goods label. WebLabel desiredGoodsLabel = new WebLabel("Desired Goods to Buy:", WebLabel.LEFT); desiredGoodsLabelPane.add(desiredGoodsLabel); // Create the desired goods profit label. desiredGoodsProfitLabel = new WebLabel("Profit:", WebLabel.LEFT); desiredGoodsLabelPane.add(desiredGoodsProfitLabel); // Create a scroll pane for the desired goods table. WebScrollPane desiredGoodsScrollPane = new WebScrollPane(); desiredGoodsScrollPane.setPreferredSize(new Dimension(-1, -1)); desiredGoodsPane.add(desiredGoodsScrollPane, BorderLayout.CENTER); // Create the desired goods table and model. desiredGoodsTableModel = new DesiredGoodsTableModel(); WebTable desiredGoodsTable = new WebTable(desiredGoodsTableModel); desiredGoodsScrollPane.setViewportView(desiredGoodsTable); // Create the bought goods panel. WebPanel boughtGoodsPane = new WebPanel(new BorderLayout()); add(boughtGoodsPane); // Create the bought goods label panel. WebPanel boughtGoodsLabelPane = new WebPanel(new GridLayout(1, 2, 0, 0)); boughtGoodsPane.add(boughtGoodsLabelPane, BorderLayout.NORTH); // Create the bought goods label. WebLabel boughtGoodsLabel = new WebLabel("Goods Bought:", WebLabel.LEFT); boughtGoodsLabelPane.add(boughtGoodsLabel); // Create the bought goods profit label. boughtGoodsProfitLabel = new WebLabel("Profit:", WebLabel.LEFT); boughtGoodsLabelPane.add(boughtGoodsProfitLabel); // Create a scroll pane for the bought goods table. WebScrollPane boughtGoodsScrollPane = new WebScrollPane(); boughtGoodsScrollPane.setPreferredSize(new Dimension(-1, -1)); boughtGoodsPane.add(boughtGoodsScrollPane, BorderLayout.CENTER); // Create the bought goods table and model. boughtGoodsTableModel = new BoughtGoodsTableModel(); WebTable boughtGoodsTable = new WebTable(boughtGoodsTableModel); boughtGoodsScrollPane.setViewportView(boughtGoodsTable); }
Example 8
Source File: RescueMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
RescueMissionCustomInfoPanel(MainDesktopPane desktop) { // Use MissionCustomInfoPanel constructor. super(); // Initialize data members. this.desktop = desktop; // Set layout. setLayout(new BorderLayout()); // Create content panel. contentPanel = new WebPanel(new SpringLayout());//new GridLayout(3, 1)); add(contentPanel, BorderLayout.NORTH); // Create rescue vehicle panel. WebPanel rescueVehiclePanel = new WebPanel(new FlowLayout(FlowLayout.RIGHT)); contentPanel.add(rescueVehiclePanel); // Create rescue vehicle title label. WebLabel rescueVehicleTitleLabel = new WebLabel("Vehicle to Rescue : ", WebLabel.LEFT); rescueVehiclePanel.add(rescueVehicleTitleLabel); // Create rescue vehicle button. rescueVehicleButton = new WebButton(""); WebPanel wrapper0 = new WebPanel(new FlowLayout(FlowLayout.LEFT)); wrapper0.add(rescueVehicleButton); contentPanel.add(wrapper0); //contentPanel.add(rescueVehicleButton); rescueVehicleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Open window for vehicle to be rescued. openRescueVehicleWindow(); } }); // Create status panel. WebPanel statusPanel = new WebPanel(new FlowLayout(FlowLayout.RIGHT)); contentPanel.add(statusPanel); // Create vehicle status title label. WebLabel vehicleStatusTitleLabel = new WebLabel("Vehicle Status : ", WebLabel.RIGHT); statusPanel.add(vehicleStatusTitleLabel); // Create vehicle status value label. vehicleStatusValueLabel = new WebLabel("", WebLabel.LEFT); WebPanel wrapper1 = new WebPanel(new FlowLayout(FlowLayout.LEFT)); wrapper1.add(vehicleStatusValueLabel); contentPanel.add(wrapper1); // Create malfunction panel. WebPanel malfunctionPanel = new WebPanel(new FlowLayout(FlowLayout.RIGHT)); contentPanel.add(malfunctionPanel); // Create malfunction title panel. WebLabel malfunctionTitleLabel = new WebLabel("Vehicle Malfunctions : ", WebLabel.RIGHT); malfunctionPanel.add(malfunctionTitleLabel); // Create malfunction list label. malfunctionListLabel = new WebLabel("", WebLabel.LEFT); WebPanel wrapper2 = new WebPanel(new FlowLayout(FlowLayout.LEFT)); wrapper2.add(malfunctionListLabel); contentPanel.add(wrapper2); // 2017-05-03 Prepare SpringLayout SpringUtilities.makeCompactGrid(contentPanel, 3, 2, //rows, cols 15, 10, //initX, initY 10, 2); //xPad, yPad }
Example 9
Source File: CollectResourcesMissionCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. */ public CollectResourcesMissionCustomInfoPanel(AmountResource resource) { // Use MissionCustomInfoPanel constructor. super(); // Initialize data members. this.resource = resource; if (resource == ResourceUtil.regolithAR) { REGOLITH_TYPES = new AmountResource[] { ResourceUtil.regolithBAR, ResourceUtil.regolithCAR, ResourceUtil.regolithDAR }; } // Set layout. setLayout(new BorderLayout()); // Create content panel. WebPanel contentPanel = new WebPanel(new GridLayout(1, 2)); add(contentPanel, BorderLayout.NORTH); // Create collection title label. String resourceString = resource.getName().substring(0, 1).toUpperCase() + resource.getName().substring(1); WebLabel collectionTitleLabel = new WebLabel( Msg.getString("CollectResourcesMissionCustomInfoPanel.totalCollected", Conversion.capitalize(resourceString))); //$NON-NLS-1$ contentPanel.add(collectionTitleLabel); // Create collection value label. collectionValueLabel = new WebLabel( Msg.getString( "CollectResourcesMissionCustomInfoPanel.kilograms", //$NON-NLS-1$ Integer.toString(0) ), WebLabel.LEFT ); contentPanel.add(collectionValueLabel); }