use of javax.swing.border.LineBorder in project OpenNotebook by jaltekruse.
the class ColorAdjustmentPanel method addPanelContent.
@Override
public void addPanelContent() {
setLayout(new GridBagLayout());
if (mAtt.getName().equals(MathObject.FILL_COLOR)) {
checkbox = new JCheckBox("fill");
if (mAtt.getValue() != null)
checkbox.setSelected(true);
else
checkbox.setSelected(false);
checkbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
if (justChangedColor) {
justChangedColor = false;
return;
}
if (mAtt.getValue() == null) {
mAtt.setValue(Color.WHITE);
}
colorLabel.setBackground(mAtt.getValue());
ColorAdjustmentPanel.this.repaint();
notebookPanel.getCurrentDocViewer().addUndoState();
notebookPanel.getCurrentDocViewer().repaintDoc();
notebookPanel.getCurrentDocViewer().updateObjectToolFrame();
} else {
mAtt.setValue(null);
colorLabel.setBackground(mAtt.getValue());
ColorAdjustmentPanel.this.repaint();
notebookPanel.getCurrentDocViewer().addUndoState();
notebookPanel.getCurrentDocViewer().repaintDoc();
notebookPanel.getCurrentDocViewer().updateObjectToolFrame();
}
}
});
}
colorLabel = new JLabel(" ");
colorLabel.setBorder(new LineBorder(Color.BLACK));
colorLabel.setOpaque(true);
colorLabel.setBackground(mAtt.getValue());
colorLabel.addMouseListener(new MouseListener() {
public void mouseClicked(MouseEvent arg0) {
}
public void mouseEntered(MouseEvent arg0) {
}
public void mouseExited(MouseEvent arg0) {
}
public void mousePressed(MouseEvent arg0) {
Color c = JColorChooser.showDialog(ColorAdjustmentPanel.this, "Choose color", ((ColorAttribute) mAtt).getValue());
((ColorAttribute) mAtt).setValue(c);
colorLabel.setBackground(mAtt.getValue());
if (checkbox != null) {
if (((ColorAttribute) mAtt).getValue() != null) {
justChangedColor = true;
checkbox.setSelected(true);
} else {
checkbox.setSelected(false);
}
}
notebookPanel.getCurrentDocViewer().addUndoState();
notebookPanel.getCurrentDocViewer().repaintDoc();
}
public void mouseReleased(MouseEvent arg0) {
}
});
GridBagConstraints con = new GridBagConstraints();
con.fill = GridBagConstraints.HORIZONTAL;
con.weightx = 1;
con.gridx = 0;
con.gridy = 0;
con.insets = new Insets(0, 0, 0, 3);
if (mAtt.getName().equals(MathObject.FILL_COLOR)) {
add(checkbox, con);
} else {
add(new JLabel(mAtt.getName()), con);
}
con.gridy = 0;
con.gridx = 1;
con.gridheight = 1;
add(colorLabel, con);
// con.gridx = 2;
// add(setColor, con);
}
use of javax.swing.border.LineBorder in project javatari by ppeccin.
the class ConsolePanel method cartridgeInserted.
@Override
public void cartridgeInserted(Cartridge cartridge) {
cartridgeInserted = cartridge != null;
String label = null;
int fore = -1, back = -1, bord = -1;
Color b;
if (cartridgeInserted) {
CartridgeInfo info = cartridge.getInfo();
label = info.label;
fore = info.labelColor;
back = info.labelBackColor;
bord = info.labelBorderColor;
}
if (label == null)
label = DEFAULT_CARTRIDGE_LABEL;
if (fore == -1)
fore = DEFAULT_CARTRIDGE_LABEL_COLOR;
if (back == -1)
back = DEFAULT_CARTRIDGE_BACK_COLOR;
cartridgeLabelComponent.setText(label);
cartridgeLabelComponent.setForeground(new Color(fore));
cartridgeLabelComponent.setBackground(b = new Color(back));
float bf = .9f;
cartridgeLabelComponent.setBorder(bord == -1 ? new LineBorder(new Color((int) (b.getRed() * bf), (int) (b.getGreen() * bf), (int) (b.getBlue() * bf)), 1) : new LineBorder(new Color(bord), 1));
removeHotspot(cartridgeInsertedHotspot);
removeHotspot(cartridgeMissingHotspot);
addHotspot(cartridgeInserted ? cartridgeInsertedHotspot : cartridgeMissingHotspot);
removeHotspot(fileHotspot);
removeHotspot(urlHotspot);
if (screen.isCartridgeChangeEnabled()) {
addHotspot(fileHotspot);
addHotspot(urlHotspot);
}
if (isVisible())
repaint();
}
use of javax.swing.border.LineBorder in project gitblit by gitblit.
the class MessageRenderer method showRef.
private void showRef(String ref, JLabel label) {
String name = ref;
Color bg = getBackground();
Border border = null;
if (name.startsWith(Constants.R_HEADS)) {
// local branch
bg = Color.decode("#CCFFCC");
name = name.substring(Constants.R_HEADS.length());
border = new LineBorder(Color.decode("#00CC33"), 1);
} else if (name.startsWith(Constants.R_REMOTES)) {
// remote branch
bg = Color.decode("#CAC2F5");
name = name.substring(Constants.R_REMOTES.length());
border = new LineBorder(Color.decode("#6C6CBF"), 1);
} else if (name.startsWith(Constants.R_TAGS)) {
// tag
bg = Color.decode("#FFFFAA");
name = name.substring(Constants.R_TAGS.length());
border = new LineBorder(Color.decode("#FFCC00"), 1);
} else if (name.equals(Constants.HEAD)) {
// HEAD
bg = Color.decode("#FFAAFF");
border = new LineBorder(Color.decode("#FF00EE"), 1);
} else {
}
label.setText(name);
label.setBackground(bg);
label.setBorder(border);
label.setVisible(true);
}
use of javax.swing.border.LineBorder in project binnavi by google.
the class CProgressPanel method createPanel.
private void createPanel(final boolean indeterminate, final boolean showSeconds, final boolean showCancelButton, final boolean addBorder) {
setLayout(new BorderLayout());
final JPanel pPb = new JPanel(new BorderLayout());
pPb.setBorder(new TitledBorder(""));
if (m_description == null) {
m_label.setVisible(false);
} else {
m_label.setText(convertTextToHtml(m_description));
}
pPb.add(m_label, BorderLayout.NORTH);
m_progressBar.setIndeterminate(indeterminate);
m_progressBar.setStringPainted(true);
final JPanel borderPanel = new JPanel(new BorderLayout());
if (addBorder) {
borderPanel.setBorder(BorderFactory.createCompoundBorder(new LineBorder(Color.GRAY), new EmptyBorder(1, 1, 1, 1)));
}
if (showCancelButton) {
final JPanel buttonPanel = new JPanel(new BorderLayout());
final JButton cancelButton = new JButton(new CancelAction());
cancelButton.setFocusable(false);
final JPanel paddingPanel = new JPanel(new BorderLayout());
paddingPanel.setBorder(new EmptyBorder(0, 1, 0, 0));
paddingPanel.setMinimumSize(new Dimension(1, 0));
buttonPanel.add(paddingPanel, BorderLayout.WEST);
buttonPanel.add(cancelButton, BorderLayout.EAST);
borderPanel.add(buttonPanel, BorderLayout.EAST);
}
borderPanel.add(m_progressBar, BorderLayout.CENTER);
pPb.add(borderPanel, BorderLayout.CENTER);
if (indeterminate && showSeconds) {
updateSecondsText();
m_timer.setRepeats(true);
}
add(pPb, BorderLayout.NORTH);
}
use of javax.swing.border.LineBorder in project binnavi by google.
the class CProjectMainPanel method createMainSplitPane.
/**
* Creates the main split pane. The main split pane divides the main window into project tree on
* the left side of the main window and the state-specific views on the right side of the main
* window.
*
* @return The main split pane.
*/
private JSplitPane createMainSplitPane() {
final JSplitPane mainSplitPane = new JSplitPane();
mainSplitPane.setOneTouchExpandable(true);
mainSplitPane.setDividerLocation(250);
mainSplitPane.setResizeWeight(0.33);
mainSplitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
m_componentPanel.setBackground(Color.WHITE);
mainSplitPane.setLeftComponent(createProjectTreePanel());
mainSplitPane.setRightComponent(m_componentPanel);
mainSplitPane.setBorder(new LineBorder(Color.GRAY));
return mainSplitPane;
}
Aggregations