Java Code Examples for com.alee.laf.panel.WebPanel#setOpaque()
The following examples show how to use
com.alee.laf.panel.WebPanel#setOpaque() .
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: ComponentUtils.java From desktopclient-java with GNU General Public License v3.0 | 6 votes |
ModalPopup(AbstractButton invokerButton) { mInvoker = invokerButton; layerPanel = new WebPanel(); layerPanel.setOpaque(false); JRootPane rootPane = SwingUtils.getRootPane(mInvoker); if (rootPane == null) { throw new IllegalStateException("not on UI start, dummkopf!"); } installPopupLayer(layerPanel, rootPane); layerPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ModalPopup.this.close(); } }); this.setRequestFocusOnShow(false); }
Example 2
Source File: ExplorationSitesPanel.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if ((value != null) && (value instanceof Color)) { Color color = (Color) value; WebPanel colorPanel = new WebPanel(); colorPanel.setOpaque(true); colorPanel.setBackground(color); return colorPanel; } else return null; }
Example 3
Source File: MiningSitePanel.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if ((value != null) && (value instanceof Color)) { Color color = (Color) value; WebPanel colorPanel = new WebPanel(); colorPanel.setOpaque(true); colorPanel.setBackground(color); return colorPanel; } else return null; }
Example 4
Source File: WebFileBreadcrumb.java From weblaf with GNU General Public License v3.0 | 5 votes |
private void installTip ( final File file, final JComponent component, final boolean showFullName ) { final WebPanel panel = new WebPanel ( new VerticalFlowLayout ( 4, 4 ) ); panel.setOpaque ( false ); if ( showFullName ) { // Full file name panel.add ( new WebLabel ( FileUtils.getDisplayFileName ( file ), FileUtils.getFileIcon ( file ) ) ); panel.add ( new WebSeparator ( WebSeparator.HORIZONTAL ) ); } // File description panel.add ( new WebLabel ( FileUtils.getFileTypeDescription ( file ), typeIcon ) ); if ( FileUtils.isFile ( file ) ) { // File modification date panel.add ( new WebLabel ( FileUtils.getDisplayFileModificationDate ( file ), dateIcon ) ); // File size panel.add ( new WebLabel ( FileUtils.getDisplayFileSize ( file ), sizeIcon ) ); } // Registering tooltip TooltipManager.setTooltip ( component, panel ); // Removing tooltip when component is removed component.addAncestorListener ( new AncestorAdapter () { @Override public void ancestorRemoved ( final AncestorEvent event ) { TooltipManager.removeTooltips ( component ); } } ); }
Example 5
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 6
Source File: BuildingPanelVehicleMaintenance.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param garage the vehicle maintenance function * @param desktop the main desktop */ public BuildingPanelVehicleMaintenance(VehicleMaintenance garage, MainDesktopPane desktop) { // Use BuildingFunctionPanel constructor super(garage.getBuilding(), desktop); // Initialize data members this.garage = garage; // 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 vehicle maintenance label // 2014-11-21 Changed font type, size and color and label text // 2014-11-21 Added internationalization for labels WebLabel vehicleMaintenanceLabel = new WebLabel(Msg.getString("BuildingPanelVehicleMaintenance.title"), WebLabel.CENTER); vehicleMaintenanceLabel.setFont(new Font("Serif", Font.BOLD, 16)); //vehicleMaintenanceLabel.setForeground(new Color(102, 51, 0)); // dark brown labelPanel.add(vehicleMaintenanceLabel); // Create vehicle number label vehicleNumberCache = garage.getCurrentVehicleNumber(); vehicleNumberLabel = new WebLabel(Msg.getString("BuildingPanelVehicleMaintenance.numberOfVehicles", vehicleNumberCache), WebLabel.CENTER); labelPanel.add(vehicleNumberLabel); // Create vehicle capacity label int vehicleCapacity = garage.getVehicleCapacity(); WebLabel vehicleCapacityLabel = new WebLabel(Msg.getString("BuildingPanelVehicleMaintenance.vehicleCapacity", vehicleCapacity), WebLabel.CENTER); labelPanel.add(vehicleCapacityLabel); // Create vehicle list panel WebPanel vehicleListPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); add(vehicleListPanel, BorderLayout.CENTER); vehicleListPanel.setOpaque(false); vehicleListPanel.setBackground(new Color(0,0,0,128)); // Create scroll panel for vehicle list WebScrollPane vehicleScrollPanel = new WebScrollPane(); vehicleScrollPanel.setPreferredSize(new Dimension(160, 60)); vehicleListPanel.add(vehicleScrollPanel); vehicleScrollPanel.setOpaque(false); vehicleScrollPanel.setBackground(new Color(0,0,0,128)); vehicleScrollPanel.getViewport().setOpaque(false); vehicleScrollPanel.getViewport().setBackground(new Color(0,0,0,128)); // Create vehicle list model vehicleListModel = new DefaultListModel<Vehicle>(); vehicleCache = new ArrayList<Vehicle>(garage.getVehicles()); Iterator<Vehicle> i = vehicleCache.iterator(); while (i.hasNext()) vehicleListModel.addElement(i.next()); // Create vehicle list vehicleList = new JList<Vehicle>(vehicleListModel); vehicleList.addMouseListener(this); vehicleScrollPanel.setViewportView(vehicleList); }
Example 7
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 8
Source File: BuildingPanelMedicalCare.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param medical the medical care building this panel is for. * @param desktop The main desktop. */ public BuildingPanelMedicalCare(MedicalCare medical, MainDesktopPane desktop) { // Use BuildingFunctionPanel constructor super(medical.getBuilding(), desktop); // Initialize data members this.medical = medical; // 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 medical care label // 2014-11-21 Changed font type, size and color and label text // 2014-11-21 Added internationalization for labels WebLabel medicalCareLabel = new WebLabel(Msg.getString("BuildingPanelMedicalCare.title"), WebLabel.CENTER); medicalCareLabel.setFont(new Font("Serif", Font.BOLD, 16)); //medicalCareLabel.setForeground(new Color(102, 51, 0)); // dark brown labelPanel.add(medicalCareLabel); // Create sick bed label WebLabel sickBedLabel = new WebLabel(Msg.getString("BuildingPanelMedicalCare.numberOfsickBeds", medical.getSickBedNum()), WebLabel.CENTER); labelPanel.add(sickBedLabel); // Create physician label physicianCache = medical.getPhysicianNum(); physicianLabel = new WebLabel(Msg.getString("BuildingPanelMedicalCare.numberOfPhysicians", physicianCache), WebLabel.CENTER); labelPanel.add(physicianLabel); // Create scroll panel for medical table WebScrollPane scrollPanel = new WebScrollPane(); scrollPanel.setPreferredSize(new Dimension(160, 80)); add(scrollPanel, BorderLayout.CENTER); scrollPanel.getViewport().setOpaque(false); scrollPanel.getViewport().setBackground(new Color(0, 0, 0, 0)); scrollPanel.setOpaque(false); scrollPanel.setBackground(new Color(0, 0, 0, 0)); //scrollPanel.setBorder( BorderFactory.createLineBorder(Color.orange) ); // Prepare medical table model medicalTableModel = new MedicalTableModel(medical); // Prepare medical table JTable medicalTable = new ZebraJTable(medicalTableModel); medicalTable.setCellSelectionEnabled(false); scrollPanel.setViewportView(medicalTable); }
Example 9
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 10
Source File: BuildingPanelAstronomicalObservation.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param observatory the astronomical observatory building function. * @param desktop the main desktop. */ public BuildingPanelAstronomicalObservation(AstronomicalObservation observatory, MainDesktopPane desktop) { // User BuildingFunctionPanel constructor. super(observatory.getBuilding(), desktop); function = observatory; currentObserversAmount = function.getObserverNum(); // Set panel layout setLayout(new BorderLayout()); // Prepare label panelAstronomicalObservation WebPanel labelPanel = new WebPanel(new GridLayout(5, 1, 0, 0)); add(labelPanel, BorderLayout.NORTH); // Astronomy top label // 2014-11-21 Changed font type, size and color and label text WebLabel astronomyLabel = new WebLabel(Msg.getString("BuildingPanelAstronomicalObservation.title"), WebLabel.CENTER); //$NON-NLS-1$ astronomyLabel.setFont(new Font("Serif", Font.BOLD, 16)); //astronomyLabel.setForeground(new Color(102, 51, 0)); // dark brown labelPanel.add(astronomyLabel); // Observer number label // 2014-11-21 Fixed currentObserversAmount observersLabel = new WebLabel(Msg.getString("BuildingPanelAstronomicalObservation.numberOfObservers", currentObserversAmount), WebLabel.CENTER); //$NON-NLS-1$ observersLabel.setHorizontalAlignment(WebLabel.CENTER); update(); labelPanel.add(observersLabel); // Observer capacityLabel WebLabel observerCapacityLabel = new WebLabel( Msg.getString( "BuildingPanelAstronomicalObservation.observerCapacity", //$NON-NLS-1$ function.getObservatoryCapacity() ),WebLabel.CENTER ); labelPanel.add(observerCapacityLabel); labelPanel.setOpaque(false); labelPanel.setBackground(new Color(0,0,0,128)); astronomyLabel.setOpaque(false); astronomyLabel.setBackground(new Color(0,0,0,128)); observersLabel.setOpaque(false); observersLabel.setBackground(new Color(0,0,0,128)); // Create the button panel. WebPanel buttonPane = new WebPanel(new FlowLayout(FlowLayout.CENTER)); // Create the orbit viewer button. WebButton button = new WebButton("Orbit Viewer"); //balloonToolTip.createBalloonTip(button, "Click to open the solar system orbit viewer"); //button.setToolTipText("Click to open the solar system orbit viewer"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // openOrbitViewer(); } }); buttonPane.add(button); labelPanel.add(buttonPane); }
Example 11
Source File: TabPanelBuildings.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void setPanelStyle(WebPanel p) { // if (isTranslucent) { p.setOpaque(false); p.setBackground(new Color(0, 0, 0, 128)); // } }
Example 12
Source File: Notifier.java From desktopclient-java with GNU General Public License v3.0 | 4 votes |
private void showNotification() { final WebDialog dialog = new WebDialog(); dialog.setUndecorated(true); dialog.setBackground(Color.BLACK); dialog.setBackground(StyleConstants.transparent); WebNotificationPopup popup = new WebNotificationPopup(PopupStyle.dark); popup.setIcon(Utils.getIcon("kontalk_small.png")); popup.setMargin(View.MARGIN_DEFAULT); popup.setDisplayTime(6000); popup.addNotificationListener(new NotificationListener() { @Override public void optionSelected(NotificationOption option) { } @Override public void accepted() { } @Override public void closed() { dialog.dispose(); } }); // content WebPanel panel = new WebPanel(); panel.setMargin(View.MARGIN_DEFAULT); panel.setOpaque(false); WebLabel title = new WebLabel("A new Message!"); title.setFontSize(View.FONT_SIZE_BIG); title.setForeground(Color.WHITE); panel.add(title, BorderLayout.NORTH); String text = "this is some message, and some longer text was added"; WebLabel message = new WebLabel(text); message.setForeground(Color.WHITE); panel.add(message, BorderLayout.CENTER); popup.setContent(panel); //popup.packPopup(); dialog.setSize(popup.getPreferredSize()); // set position on screen GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle screenBounds = gc.getBounds(); // get height of the task bar // doesn't work on all environments //Insets toolHeight = toolkit.getScreenInsets(popup.getGraphicsConfiguration()); int toolHeight = 40; dialog.setLocation(screenBounds.width - dialog.getWidth() - 10, screenBounds.height - toolHeight - dialog.getHeight()); dialog.setVisible(true); NotificationManager.showNotification(dialog, popup); }