Java Code Examples for com.alee.laf.scroll.WebScrollPane#setOpaque()

The following examples show how to use com.alee.laf.scroll.WebScrollPane#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: BuildingPanelMalfunctionable.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor.
 * 
 * @param malfunctionable the malfunctionable building the panel is for.
 * @param desktop         The main desktop.
 */
public BuildingPanelMalfunctionable(Malfunctionable malfunctionable, MainDesktopPane desktop) {

	// Use BuildingFunctionPanel constructor
	super((Building) malfunctionable, desktop);

	// Initialize data members.
	this.malfunctionable = malfunctionable;

	// Set panel layout
	setLayout(new BorderLayout());

	// Create malfunctions label
	WebLabel malfunctionsLabel = new WebLabel(Msg.getString("BuildingPanelMalfunctionable.title"), WebLabel.CENTER);
	malfunctionsLabel.setFont(new Font("Serif", Font.BOLD, 16));
	// malfunctionsLabel.setForeground(new Color(102, 51, 0)); // dark brown
	add(malfunctionsLabel, BorderLayout.NORTH);

	// Create scroll panel for malfunction list
	WebScrollPane scrollPanel = new WebScrollPane();
	scrollPanel.setPreferredSize(new Dimension(170, 90));
	add(scrollPanel, BorderLayout.CENTER);
	scrollPanel.setOpaque(false);
	scrollPanel.setBackground(new Color(0, 0, 0, 128));
	scrollPanel.getViewport().setOpaque(false);
	scrollPanel.getViewport().setBackground(new Color(0, 0, 0, 128));// 0, 0, 0, 0));
	// scrollPanel.setBorder( BorderFactory.createLineBorder(Color.LIGHT_GRAY) );

	// Create malfunction list main panel.
	WebPanel malfunctionListMainPanel = new WebPanel(new BorderLayout(0, 0));
	scrollPanel.setViewportView(malfunctionListMainPanel);

	// Create malfunction list panel
	malfunctionListPanel = new WebPanel();
	malfunctionListPanel.setLayout(new BoxLayout(malfunctionListPanel, BoxLayout.Y_AXIS));
	malfunctionListMainPanel.add(malfunctionListPanel, BorderLayout.NORTH);

	// Create malfunction panels
	malfunctionCache = new ArrayList<Malfunction>(malfunctionable.getMalfunctionManager().getMalfunctions());
	malfunctionPanels = new ArrayList<MalfunctionPanel>();
	Iterator<Malfunction> i = malfunctionCache.iterator();
	while (i.hasNext()) {
		MalfunctionPanel panel = new MalfunctionPanel(i.next());
		malfunctionListPanel.add(panel);
		malfunctionPanels.add(panel);
	}
}
 
Example 2
Source File: BuildingPanelVehicleMaintenance.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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 3
Source File: BuildingPanelMedicalCare.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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);
}