Java Code Examples for javax.swing.JLabel#setOpaque()

The following examples show how to use javax.swing.JLabel#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: AboutDialog.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Add name and value labels.
 *
 * @param c Component.
 * @param name Name.
 * @param val Value.
 * @param border Border.
 */
private void addAboutItem(JComponent c, String name, Object val, Border border) {
    String v = val != null ? val.toString() : "n/a";
    String tip = String.format("<html><b>%s</b> &#10159; %s</html>", name, val);

    JLabel lb = new JLabel(name);
    lb.setToolTipText(tip);

    JLabel field = new JLabel(v);
    field.setOpaque(true);
    field.setBackground(Color.WHITE);
    field.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(VALUE_BORDER_COLOR, 1),
        BorderFactory.createEmptyBorder(0, 3, 0, 3)));

    field.setToolTipText(tip);

    if (border != null)
        field.setBorder(border);

    c.add(lb, gbcLicenseLabel());
    c.add(field, gbcLicenseField());
}
 
Example 2
Source File: ParameterErrorInfoBubble.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Decorates the given parameter editor panel with a "mandatory parameter" hint.
 *
 * @param parameterEditor
 *            the parameter editor panel
 * @return the decorated panel
 */
private JPanel decorateParameterPanel(final JPanel parameterEditor) {
	JPanel parentPanel = new JPanel(new GridBagLayout());
	GridBagConstraints gbc = new GridBagConstraints();
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 1.0;
	gbc.weighty = 1.0;
	gbc.fill = GridBagConstraints.BOTH;
	parentPanel.add(parameterEditor, gbc);

	JLabel warningLabel = new JLabel(I18N.getGUIMessage("gui.bubble." + decorateI18N + ".label"));
	boolean isError = getStyle() == BubbleStyle.ERROR;
	warningLabel.setIcon(isError ? ERROR_ICON : WARNING_ICON);
	warningLabel.setBackground(isError ? BubbleStyle.ERROR.getColor() : BubbleStyle.WARNING.getColor());
	warningLabel.setOpaque(true);
	warningLabel.setBorder(new EmptyBorder(1, 1, 1, 0));
	gbc.gridy += 1;
	gbc.weighty = 0.0;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.insets = new Insets(2, 0, 0, 0);
	parentPanel.add(warningLabel, gbc);

	return parentPanel;
}
 
Example 3
Source File: ColorScalePanel.java    From chipster with MIT License 6 votes vote down vote up
public ColorScalePanel(DataModel dataModel, List<String> colorGroupNames, List<Float> colorGroupValues){
	this.dataModel = dataModel;
	this.colorGroupValues = colorGroupValues;
					
	this.setLayout(new GridBagLayout());

	GridBagConstraints c = new GridBagConstraints();
	c.gridy = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.weightx = 1.0;

	for(String groupStr : colorGroupNames){
		Color color = dataModel.getColorFor(colorGroupValues.get(colorGroupNames.indexOf(groupStr)));

		BallIcon icon = new BallIcon(color);
		JLabel label =  new JLabel(groupStr, icon, SwingConstants.LEFT );
		label.setOpaque(false);
		label.setForeground(super.getForeground());		
		this.add(label, c );

		c.gridy++;			
	}
}
 
Example 4
Source File: StatusBarPhaseDisplay.java    From megamek with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets up the status bar with toggle buttons for the mek display and map.
 */
protected void setupStatusBar(String defStatus) {
    SkinSpecification pdSkinSpec = SkinXMLHandler
            .getSkin(SkinSpecification.UIComponents.PhaseDisplay.getComp());
    
    panStatus = new JPanel();
    panStatus.setOpaque(false);
    labStatus = new JLabel(defStatus, SwingConstants.CENTER);
    labStatus.setForeground(pdSkinSpec.fontColors.get(0));
    labStatus.setOpaque(false);

    // layout
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    panStatus.setLayout(gridbag);

    c.insets = new Insets(0, 1, 0, 1);
    c.fill = GridBagConstraints.HORIZONTAL;

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;
    c.weighty = 0.0;
    gridbag.setConstraints(labStatus, c);
    panStatus.add(labStatus);
}
 
Example 5
Source File: ImageCellRenderer.java    From WorldGrower with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
	JLabel label = new JLabel();
	label.setOpaque(false);
	
	label.setIcon(new ImageIcon(imageInfoReader.getImage((ImageIds) value, null)));

	if (isSelected) {
		label.setForeground(table.getSelectionForeground());
		label.setBackground(table.getSelectionBackground());
	} else {
		label.setForeground(table.getForeground());
		label.setBackground(table.getBackground());
	}

	return label;
}
 
Example 6
Source File: RQueries.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
public PopupSeparator(String text) {
    setLayout(new BorderLayout());
    setOpaque(false);

    JLabel l = new JLabel(text);
    l.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 3));
    if (UIUtils.isWindowsLookAndFeel()) l.setOpaque(true);
    l.setFont(l.getFont().deriveFont(Font.BOLD, l.getFont().getSize2D() - 1));
    if (UIUtils.isWindowsLookAndFeel()) l.setForeground(UIUtils.getDisabledLineColor());

    add(l, BorderLayout.WEST);

    if (UIUtils.isGTKLookAndFeel()) {
        add(UIUtils.createHorizontalSeparator(), BorderLayout.CENTER);
    } else {
        JComponent sep = new JPopupMenu.Separator();
        add(sep, BorderLayout.CENTER);

        if (UIUtils.isOracleLookAndFeel()) {
            setOpaque(true);
            setBackground(sep.getBackground());
            l.setForeground(sep.getForeground());
        }
    }
}
 
Example 7
Source File: InitPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void initComponents() {        
    if (!oPanel.isPrepared()) {
        initComponent = new JLabel(NbBundle.getMessage(InitPanel.class, "LBL_computing")); // NOI18N
        initComponent.setPreferredSize(new Dimension(850, 450));
        // avoid flicking ?
        Color c = UIManager.getColor("Tree.background"); // NOI18N
        if (c == null) {
            //GTK 1.4.2 will return null for Tree.background
            c = Color.WHITE;
        }
        initComponent.setBackground(c);    // NOI18N               
        initComponent.setHorizontalAlignment(SwingConstants.CENTER);
        initComponent.setOpaque(true);
        
        CardLayout card = new CardLayout();
        setLayout(card);            
        add(initComponent, "init");    // NOI18N
        card.show(this, "init"); // NOI18N        
        Utilities.attachInitJob(this, this);
    } else {
        finished();  
    }
}
 
Example 8
Source File: TCSObjectNameListCellRenderer.java    From openAGV with Apache License 2.0 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList<? extends TCSObject<?>> list,
                                              TCSObject<?> value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus) {
  JLabel label
      = (JLabel) defaultRenderer.getListCellRendererComponent(list,
                                                              value,
                                                              index,
                                                              isSelected,
                                                              cellHasFocus);
  label.setOpaque(true);
  if (value == null) {
    label.setText("");
  }
  else {
    label.setText(value.getName());
  }
  return label;
}
 
Example 9
Source File: Utils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
PlaceholderPanel(String className) {
    super(null);
    
    putClientProperty("className", className);
    
    setOpaque(true);
    setBorder(BorderFactory.createLineBorder(LINE));
    
    label = new JLabel(BrowserUtils.getSimpleType(className), JLabel.CENTER);
    label.setOpaque(true);
}
 
Example 10
Source File: MagicCardsTreeCellRenderer.java    From MtgDesktopCompanion with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean isLeaf, int row, boolean focused) {
	JLabel c = (JLabel)new DefaultTreeCellRenderer().getTreeCellRendererComponent(tree, value, selected, expanded, isLeaf, row, focused);
	try {
		if (((DefaultMutableTreeNode) value).getUserObject() instanceof MagicEdition) {
			MagicEdition ed = (MagicEdition) ((DefaultMutableTreeNode) value).getUserObject();
			c.setIcon(IconSetProvider.getInstance().get16(ed.getId()));
		} else if (((DefaultMutableTreeNode) value).getUserObject() instanceof MagicCard) {
			MagicCard mc = (MagicCard) ((DefaultMutableTreeNode) value).getUserObject();

			c.setOpaque(false);
			c.setIcon(MTGConstants.ICON_MANA_INCOLOR);

			if (mc.isArtifact()) {
				c.setIcon(map.get(MTGColor.UNCOLOR));
			}
			if (mc.getColors().size() == 1) {
				c.setIcon(map.get(mc.getColors().get(0)));
			}
			if (mc.isMultiColor()) {
				c.setIcon(MTGConstants.ICON_MANA_GOLD);
			}
			if (mc.isLand()) {
				c.setIcon(MTGConstants.ICON_MANA_INCOLOR);
			}
		} 
		else if (((DefaultMutableTreeNode) value).getUserObject() instanceof Packaging) {
			c.setIcon(MTGConstants.ICON_PACKAGE_SMALL);
		}
		else {
			c.setIcon(MTGConstants.ICON_BACK);
		}
		return c;
	} catch (Exception e) {
		return c;
	}
}
 
Example 11
Source File: ClientListCellRenderer.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
/** This method initializes this */
private void initialize() {
    id = new JLabel();
    id.setText(" ");
    id.setBackground(java.awt.SystemColor.text);
    id.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    id.setPreferredSize(new java.awt.Dimension(100, 15));
    id.setMinimumSize(new java.awt.Dimension(80, 15));
    id.setFont(FontUtils.getFont(FontUtils.Size.standard));
    id.setOpaque(true);

    url = new JLabel();
    url.setText(" ");
    url.setBackground(java.awt.SystemColor.text);
    url.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    url.setPreferredSize(new java.awt.Dimension(320, 15));
    url.setMinimumSize(new java.awt.Dimension(320, 15));
    url.setFont(FontUtils.getFont(FontUtils.Size.standard));
    url.setOpaque(true);

    this.setLayout(new GridBagLayout());
    if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
        this.setSize(328, 11);
    }
    this.setFont(FontUtils.getFont(FontUtils.Size.standard));

    this.add(id, LayoutHelper.getGBC(1, 0, 1, 0.0D, new Insets(0, 0, 0, 0)));
    this.add(url, LayoutHelper.getGBC(2, 0, 1, 1.0D, new Insets(0, 0, 0, 0)));
}
 
Example 12
Source File: AbstractVTMatchTableModel.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(GTableCellRenderingData data) {

	Object value = data.getValue();

	DisplayableListingAddress displayableAddress =
		(DisplayableListingAddress) value;
	String addressString = displayableAddress.getDisplayString();

	GTableCellRenderingData renderData = data.copyWithNewValue(addressString);

	JLabel renderer = (JLabel) super.getTableCellRendererComponent(renderData);

	Program program = displayableAddress.getProgram();
	Address address = displayableAddress.getAddress();
	if (!address.isMemoryAddress() && symbolInspector != null) {
		Symbol s = program.getSymbolTable().getPrimarySymbol(address);
		symbolInspector.setProgram(program);
		Color c = (s != null) ? symbolInspector.getColor(s) : Color.RED;
		setForeground(c);
	}
	else if (!program.getMemory().contains(address)) {
		setForeground(Color.RED);
	}

	renderer.setOpaque(true);

	return renderer;
}
 
Example 13
Source File: AbstractVTMatchTableModel.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(GTableCellRenderingData data) {

	Object value = data.getValue();

	DisplayableLabel displayableLabel = (DisplayableLabel) value;
	String labelString = displayableLabel.getDisplayString();

	GTableCellRenderingData renderData = data.copyWithNewValue(labelString);

	JLabel renderer = (JLabel) super.getTableCellRendererComponent(renderData);
	renderer.setToolTipText(null);

	Symbol symbol = displayableLabel.getSymbol();
	if (symbol != null) {
		Namespace parentNamespace = symbol.getParentNamespace();
		if (!parentNamespace.isGlobal()) {
			renderer.setToolTipText(symbol.getName(true));
		}
		if (symbolInspector != null) {
			symbolInspector.setProgram(symbol.getProgram());
			renderer.setForeground(symbolInspector.getColor(symbol));
		}
	}
	else {
		renderer.setForeground(Color.RED);
	}

	renderer.setOpaque(true);
	setBold();

	return renderer;
}
 
Example 14
Source File: ProjectTree.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
	final JLabel label = (JLabel)super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
	label.setText(label.getText().replace('_', ' ')); // just for display
	if (value.getClass() == DefaultMutableTreeNode.class) {
		final Object obb = ((DefaultMutableTreeNode)value).getUserObject();
		final Object ob = ((ProjectThing)obb).getObject();
		if (ob.getClass().getSuperclass() == Displayable.class) {
			final Displayable displ = (Displayable)ob;
			final Layer layer = Display.getFrontLayer();
			if (null != layer && (displ == Display.getFront().getActive() || layer.contains(displ))) {
				label.setOpaque(true); //this label
				label.setBackground(ACTIVE_DISPL_COLOR); // this label
				//Utils.log(" -- setting background");
			} else {
				label.setOpaque(false); //this label
				label.setBackground(background);
				//Utils.log(" not contained ");
			}
		} else {
			label.setOpaque(false); //this label
			label.setBackground(background);
			//Utils.log("ob is " + ob);
		}
	} else {
		label.setOpaque(false);
		label.setBackground(background);
		//Utils.log("value is " + value);
	}
	return label;
}
 
Example 15
Source File: ThemesComboBox.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
    final JLabel lbl = new JLabel(value, JLabel.CENTER);
    lbl.setOpaque(isSelected);
    lbl.setFont(lbl.getFont().deriveFont(14f));
    lbl.setFont(value.equals(ThemeFactory.getInstance().getCurrentTheme().getName()) ? lbl.getFont().deriveFont(Font.BOLD) : lbl.getFont());
    lbl.setBackground(isSelected ? Color.LIGHT_GRAY : lbl.getBackground());
    lbl.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    return lbl;
}
 
Example 16
Source File: ReprocessedSeparatorTableCell.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
public ReprocessedSeparatorTableCell(final JTable jTable, final SeparatorList<ReprocessedInterface> separatorList, final ActionListener actionListener) {
	super(jTable, separatorList);

	jColor = new JLabel();
	jColor.setOpaque(true);
	jColor.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));

	jRemove = new JButton(TabsReprocessed.get().remove());
	jRemove.setOpaque(false);
	jRemove.setActionCommand(ReprocessedCellAction.REMOVE.name());
	jRemove.addActionListener(actionListener);

	jName = new JLabel();
	Font font = jName.getFont();
	jName.setFont(new Font(font.getName(), Font.BOLD, font.getSize() + 1));

	JLabel jSellPriceLabel = new JLabel(TabsReprocessed.get().price());
	jSellPriceLabel.setFont(new Font(font.getName(), Font.BOLD, font.getSize()));
	jPrice = new JLabel();

	jBatchSizeLabel = new JLabel(TabsReprocessed.get().batch());
	jBatchSizeLabel.setFont(new Font(font.getName(), Font.BOLD, font.getSize()));
	jBatchSize = new JLabel();

	jValueLabel = new JLabel(TabsReprocessed.get().value());
	jValueLabel.setFont(new Font(font.getName(), Font.BOLD, font.getSize()));
	jValue = new JLabel();

	layout.setHorizontalGroup(
		layout.createSequentialGroup()
			.addComponent(jExpand)
			.addGap(5)
			.addComponent(jColor, Program.getButtonsHeight() - 6, Program.getButtonsHeight() - 6, Program.getButtonsHeight() - 6)
			.addGap(10)
			.addComponent(jRemove, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
			.addGap(10)
			//.addComponent(jNameLabel)
			//.addGap(5)
			.addComponent(jName, 220, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			.addGap(10)
			.addComponent(jSellPriceLabel)
			.addGap(5)
			.addComponent(jPrice)
			.addGap(10)
			.addComponent(jValueLabel)
			.addGap(5)
			.addComponent(jValue)
			.addGap(10)
			.addComponent(jBatchSizeLabel)
			.addGap(5)
			.addComponent(jBatchSize)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addGap(2)
			.addGroup(layout.createParallelGroup()
				.addComponent(jExpand, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addGroup(layout.createSequentialGroup()
					.addGap(3)
					.addComponent(jColor, Program.getButtonsHeight() - 6, Program.getButtonsHeight() - 6, Program.getButtonsHeight() - 6)
				)
				.addComponent(jRemove, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				//.addComponent(jNameLabel, Program.BUTTONS_HEIGHT, Program.BUTTONS_HEIGHT, Program.BUTTONS_HEIGHT)
				.addComponent(jName, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jSellPriceLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jPrice, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jValueLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jValue, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jBatchSizeLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jBatchSize, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			)
			.addGap(2)
	);
}
 
Example 17
Source File: OrderEntryRenderer.java    From MtgDesktopCompanion with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,int row, int column) {
	
	OrderEntry o = (OrderEntry)table.getValueAt(row, 0);
	
	JLabel comp = new JLabel(String.valueOf(value));
	comp.setFont(MTGControler.getInstance().getFont().deriveFont(Font.PLAIN));
	comp.setHorizontalAlignment(SwingConstants.CENTER);
	comp.setOpaque(true);
	
	if (((OrderEntry) table.getValueAt(row, 0)).isUpdated()) {
		comp.setBackground(Color.GREEN);
		comp.setForeground(table.getForeground());
	}
	else if (isSelected) {
		comp.setBackground(table.getSelectionBackground());
		comp.setForeground(table.getSelectionForeground());
	} else {
		comp.setBackground(table.getBackground());
		comp.setForeground(table.getForeground());
	}
	
	
	try {
		if(value instanceof Double)
		{	
			if (o.getTypeTransaction()==TYPE_TRANSACTION.BUY)
			{
				comp.setIcon(MTGConstants.ICON_OUT);
			}
			else
			{
				comp.setIcon(MTGConstants.ICON_IN);
			}
		}	
		return comp;
	} catch (Exception e) {
		comp.setText(e.getMessage());
		return comp;
	}

}
 
Example 18
Source File: VideoItemEditor.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
public VideoItemEditor(MediaImageSource imgSource) {
	component = new JPanel(new BorderLayout(getScaledInt(5), getScaledInt(5)));
	component.setBorder(new EmptyBorder(0, getScaledInt(5), getScaledInt(5), getScaledInt(5)));
	panel = new JPanel(new BorderLayout());
	lbl = new JLabel();
	lbl.setVerticalAlignment(JLabel.CENTER);
	lbl.setVerticalTextPosition(JLabel.CENTER);
	lbl.setFont(FontResource.getBigFont());
	lblIcon = new JLabel();
	lblIcon.setOpaque(true);
	lblIcon.setMinimumSize(new Dimension(getScaledInt(119), getScaledInt(92)));
	lblIcon.setMaximumSize(new Dimension(getScaledInt(119), getScaledInt(92)));
	lblIcon.setPreferredSize(new Dimension(getScaledInt(119), getScaledInt(92)));
	lblIcon.setHorizontalAlignment(JLabel.CENTER);
	ico = ImageResource.getIcon("videoplay.png",94,92);
	lblIcon.setIcon(ico);
	// lblIcon.setBorder(new EmptyBorder(12, 5, 5, 5));
	lblIcon.setVerticalAlignment(JLabel.CENTER);
	// lblIcon.setPreferredSize(new Dimension(53, 53));

	JPanel p1 = new JPanel(new BorderLayout());
	p1.setOpaque(false);
	p1.add(lblIcon);
	chk = new JCheckBox("");
	chk.setOpaque(false);
	chk.setIcon(ImageResource.getIcon("unchecked.png",16,16));
	chk.setSelectedIcon(ImageResource.getIcon("checked.png",16,16));
	p1.add(chk, BorderLayout.WEST);
	p1.setBorder(new EmptyBorder(getScaledInt(12), 0, getScaledInt(5), getScaledInt(5)));
	component.add(p1, BorderLayout.WEST);
	cmbModel = new DefaultComboBoxModel<>();
	cmb = new JComboBox<>(cmbModel);
	cmb.setPreferredSize(new Dimension(getScaledInt(200), getScaledInt(30)));
	cmb.setOpaque(false);
	cmb.setBorder(null);
	panel.add(lbl);
	panel.add(cmb, BorderLayout.SOUTH);
	panel.setOpaque(false);
	panel.setBorder(new EmptyBorder(0, 0, getScaledInt(5), getScaledInt(5)));
	component.add(panel);
	lblBorder = new JLabel();
	lblBorder.setPreferredSize(new Dimension(getScaledInt(100), 1));
	lblBorder.setMaximumSize(new Dimension(getScaledInt(100), 1));
	lblBorder.setBackground(ColorResource.getDarkerBgColor());
	component.add(lblBorder, BorderLayout.NORTH);
	component.setOpaque(false);
	this.imgSource = imgSource;
	// component.setBackground(ColorResource.getSelectionColor());
}
 
Example 19
Source File: LoadoutSeparatorTableCell.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
public LoadoutSeparatorTableCell(final JTable jTable, final SeparatorList<Loadout> separatorList) {
	super(jTable, separatorList);

	jOwner = new JLabel();
	Font largeFont = new Font(jOwner.getFont().getName(), Font.BOLD, jOwner.getFont().getSize() + 1);
	jOwner.setBorder(null);
	jOwner.setBackground(Color.BLACK);
	jOwner.setForeground(Color.WHITE);
	jOwner.setOpaque(true);
	jOwner.setFont(largeFont);

	jLocation = new JLabel();
	jLocation.setBorder(null);
	jLocation.setBackground(Color.BLACK);
	jLocation.setForeground(Color.WHITE);
	jLocation.setOpaque(true);
	jLocation.setFont(largeFont);

	jFlag = new JLabel();
	jFlag.setBorder(null);
	jFlag.setOpaque(false);
	jFlag.setBackground(Color.BLACK);
	jFlag.setFont(largeFont);


	layout.setHorizontalGroup(
		layout.createParallelGroup()
			.addGroup(layout.createSequentialGroup()
				.addGap(1)
				.addComponent(jOwner, 0, 0, Integer.MAX_VALUE)
				.addGap(1)
			)
			.addGroup(layout.createSequentialGroup()
				.addGap(1)
				.addComponent(jLocation, 0, 0, Integer.MAX_VALUE)
				.addGap(1)
			)
			.addGroup(layout.createSequentialGroup()
				.addComponent(jExpand)
				.addGap(1)
				.addComponent(jFlag, 0, 0, Integer.MAX_VALUE)
			)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addGap(1)
			.addComponent(jOwner, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addComponent(jLocation, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addGap(1)
			.addGroup(layout.createParallelGroup()
				.addComponent(jExpand, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jFlag, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			)
			.addGap(2)
	);
}
 
Example 20
Source File: VTMarkupItemsTableModel.java    From ghidra with Apache License 2.0 3 votes vote down vote up
@Override
public Component getTableCellRendererComponent(GTableCellRenderingData data) {

	Object value = data.getValue();

	boolean isInDB = ((Boolean) value).booleanValue();

	GTableCellRenderingData renderData = data.copyWithNewValue(isInDB ? "yes" : null);

	JLabel renderer = (JLabel) super.getTableCellRendererComponent(renderData);
	renderer.setOpaque(true);

	return renderer;
}