use of javax.swing.border.TitledBorder in project intellij-community by JetBrains.
the class ResourceBundleEditor method updateEditorsFromProperties.
void updateEditorsFromProperties(final boolean checkIsUnderUndoRedoAction) {
String propertyName = getSelectedPropertyName();
((CardLayout) myValuesPanel.getLayout()).show(myValuesPanel, propertyName == null ? NO_PROPERTY_SELECTED : VALUES);
if (propertyName == null)
return;
final UndoManagerImpl undoManager = (UndoManagerImpl) UndoManager.getInstance(myProject);
for (final PropertiesFile propertiesFile : myResourceBundle.getPropertiesFiles()) {
final EditorEx editor = myEditors.get(propertiesFile.getVirtualFile());
if (editor == null)
continue;
final IProperty property = propertiesFile.findPropertyByKey(propertyName);
final Document document = editor.getDocument();
CommandProcessor.getInstance().executeCommand(null, () -> ApplicationManager.getApplication().runWriteAction(() -> {
if (!checkIsUnderUndoRedoAction || !undoManager.isActive() || !(undoManager.isRedoInProgress() || undoManager.isUndoInProgress())) {
updateDocumentFromPropertyValue(getPropertyEditorValue(property), document, propertiesFile.getVirtualFile());
}
}), "", this);
JPanel titledPanel = myTitledPanels.get(propertiesFile.getVirtualFile());
((TitledBorder) titledPanel.getBorder()).setTitleColor(property == null ? JBColor.RED : UIUtil.getLabelTextForeground());
titledPanel.repaint();
}
}
use of javax.swing.border.TitledBorder in project intellij-community by JetBrains.
the class GuiUtils method enableComponent.
private static void enableComponent(Component component, boolean enabled) {
if (component.isEnabled() == enabled)
return;
component.setEnabled(enabled);
if (component instanceof JPanel) {
final Border border = ((JPanel) component).getBorder();
if (border instanceof TitledBorder) {
Color color = enabled ? component.getForeground() : UIUtil.getInactiveTextColor();
((TitledBorder) border).setTitleColor(color);
}
} else if (component instanceof JLabel) {
Color color = UIUtil.getInactiveTextColor();
if (color == null)
color = component.getForeground();
@NonNls String changeColorString = "<font color=#" + colorToHex(color) + ">";
final JLabel label = (JLabel) component;
@NonNls String text = label.getText();
if (text != null && text.startsWith("<html>")) {
if (StringUtil.startsWithConcatenation(text, "<html>", changeColorString) && enabled) {
text = "<html>" + text.substring(("<html>" + changeColorString).length());
} else if (!StringUtil.startsWithConcatenation(text, "<html>", changeColorString) && !enabled) {
text = "<html>" + changeColorString + text.substring("<html>".length());
}
label.setText(text);
}
} else if (component instanceof JTable) {
TableColumnModel columnModel = ((JTable) component).getColumnModel();
for (int i = 0; i < columnModel.getColumnCount(); i++) {
TableCellRenderer cellRenderer = columnModel.getColumn(0).getCellRenderer();
if (cellRenderer instanceof Component) {
enableComponent((Component) cellRenderer, enabled);
}
}
}
}
use of javax.swing.border.TitledBorder in project intellij-community by JetBrains.
the class SearchUtil method processComponent.
private static void processComponent(JComponent component, Set<OptionDescription> configurableOptions, String path) {
if (component instanceof SkipSelfSearchComponent)
return;
final Border border = component.getBorder();
if (border instanceof TitledBorder) {
final TitledBorder titledBorder = (TitledBorder) border;
final String title = titledBorder.getTitle();
if (title != null) {
processUILabel(title, configurableOptions, path);
}
}
if (component instanceof JLabel) {
final String label = ((JLabel) component).getText();
if (label != null) {
processUILabel(label, configurableOptions, path);
}
} else if (component instanceof JCheckBox) {
final String checkBoxTitle = ((JCheckBox) component).getText();
if (checkBoxTitle != null) {
processUILabel(checkBoxTitle, configurableOptions, path);
}
} else if (component instanceof JRadioButton) {
final String radioButtonTitle = ((JRadioButton) component).getText();
if (radioButtonTitle != null) {
processUILabel(radioButtonTitle, configurableOptions, path);
}
} else if (component instanceof JButton) {
final String buttonTitle = ((JButton) component).getText();
if (buttonTitle != null) {
processUILabel(buttonTitle, configurableOptions, path);
}
}
if (component instanceof JTabbedPane) {
final JTabbedPane tabbedPane = (JTabbedPane) component;
final int tabCount = tabbedPane.getTabCount();
for (int i = 0; i < tabCount; i++) {
final String title = path != null ? path + '.' + tabbedPane.getTitleAt(i) : tabbedPane.getTitleAt(i);
processUILabel(title, configurableOptions, title);
final Component tabComponent = tabbedPane.getComponentAt(i);
if (tabComponent instanceof JComponent) {
processComponent((JComponent) tabComponent, configurableOptions, title);
}
}
} else if (component instanceof TabbedPaneWrapper.TabbedPaneHolder) {
final TabbedPaneWrapper tabbedPane = ((TabbedPaneWrapper.TabbedPaneHolder) component).getTabbedPaneWrapper();
final int tabCount = tabbedPane.getTabCount();
for (int i = 0; i < tabCount; i++) {
String tabTitle = tabbedPane.getTitleAt(i);
final String title = path != null ? path + '.' + tabTitle : tabTitle;
processUILabel(title, configurableOptions, title);
final JComponent tabComponent = tabbedPane.getComponentAt(i);
if (tabComponent != null) {
processComponent(tabComponent, configurableOptions, title);
}
}
} else {
final Component[] components = component.getComponents();
if (components != null) {
for (Component child : components) {
if (child instanceof JComponent) {
processComponent((JComponent) child, configurableOptions, path);
}
}
}
}
}
use of javax.swing.border.TitledBorder in project ACS by ACS-Community.
the class LogLevelSelectorPanel method initMimimumLevelsPanel.
/**
* Setup the panel to show minimum levels
*
* @return
*/
private JPanel initMimimumLevelsPanel() {
TitledBorder border = BorderFactory.createTitledBorder("Minimum Log Levels");
JPanel mainPnl = new JPanel();
GridBagLayout gl = new GridBagLayout();
GridBagConstraints gc = new GridBagConstraints();
mainPnl.setLayout(gl);
mainPnl.setBorder(border);
JLabel localLbl = new JLabel("Current minimum local level");
minLocal = new JLabel("");
JLabel globalLbl = new JLabel("Current minimum remote level");
minGlobal = new JLabel("");
gc.insets = new Insets(5, 10, 5, 10);
gc.gridx = 0;
gc.gridy = 0;
gl.setConstraints(localLbl, gc);
mainPnl.add(localLbl);
gc.gridx++;
gc.insets.right *= 2;
gl.setConstraints(minLocal, gc);
mainPnl.add(minLocal);
gc.gridx++;
gc.insets.right /= 2;
gl.setConstraints(globalLbl, gc);
mainPnl.add(globalLbl);
gc.gridx++;
gl.setConstraints(minGlobal, gc);
mainPnl.add(minGlobal);
updateMinLevels();
return mainPnl;
}
use of javax.swing.border.TitledBorder in project adempiere by adempiere.
the class GroovyEditor method jbInit.
/**
* Static Layout
* @throws Exception
*/
void jbInit() throws Exception {
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
titledBorder2 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)), Msg.getMsg(Env.getCtx(), "ScriptEditor"));
mainPanel.setLayout(borderLayout1);
bOK.addActionListener(this);
bCancel.addActionListener(this);
bProcess.addActionListener(this);
bHelp.addActionListener(this);
editorPane.setBorder(titledBorder2);
editorPane.setPreferredSize(new Dimension(500, 500));
southPanel.setLayout(southLayout);
resultPanel.setLayout(resultLayout);
lResult.setText(Msg.getMsg(Env.getCtx(), "ScriptResult"));
fResult.setBackground(Color.lightGray);
fResult.setEditable(false);
fResult.setText("");
okPanel.setLayout(okLayout);
getContentPane().add(mainPanel);
editorPane.getViewport().add(editor, null);
mainPanel.add(southPanel, BorderLayout.SOUTH);
southPanel.add(okPanel, BorderLayout.EAST);
okPanel.add(bCancel, null);
okPanel.add(bOK, null);
southPanel.add(resultPanel, BorderLayout.CENTER);
resultPanel.add(bProcess, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
resultPanel.add(lResult, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
resultPanel.add(fResult, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
resultPanel.add(bHelp, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
mainPanel.add(editorPane, BorderLayout.CENTER);
}
Aggregations