本文整理匯總了Java中javax.swing.JToolBar.setBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java JToolBar.setBackground方法的具體用法?Java JToolBar.setBackground怎麽用?Java JToolBar.setBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JToolBar
的用法示例。
在下文中一共展示了JToolBar.setBackground方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initComponents
import javax.swing.JToolBar; //導入方法依賴的package包/類
private void initComponents() {
setLayout (new BorderLayout ());
contentComponent = new javax.swing.JPanel(new BorderLayout ());
add (contentComponent, BorderLayout.CENTER); //NOI18N
JToolBar toolBar = new JToolBar(JToolBar.VERTICAL);
toolBar.setFloatable(false);
toolBar.setRollover(true);
toolBar.setBorderPainted(true);
if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
toolBar.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
}
toolBar.setBorder(javax.swing.BorderFactory.createCompoundBorder(
javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 1,
javax.swing.UIManager.getDefaults().getColor("Separator.background")),
javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 1,
javax.swing.UIManager.getDefaults().getColor("Separator.foreground"))));
add(toolBar, BorderLayout.WEST);
JComponent buttonsPane = toolBar;
viewModelListener = new ViewModelListener (
name,
contentComponent,
buttonsPane,
propertiesHelpID,
ImageUtilities.loadImage(icon)
);
}
示例2: createFilterToolBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
private JToolBar createFilterToolBar() {
final FiltersDescriptor filtersDesc = FiltersDescriptor.getInstance();
// configure toolbar
final JToolBar toolbar = new NoBorderToolBar();
toolbar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
toolbar.setFloatable(false);
//toolbar.setRollover(true);
toolbar.setBorderPainted(false);
toolbar.setOpaque(false);
if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
toolbar.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
}
createFilterToolBarUI(toolbar, filtersDesc);
filtersDesc.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
createFilterToolBarUI(toolbar, filtersDesc);
}
});
}
});
return toolbar;
}
示例3: PerspectivesPanelBar
import javax.swing.JToolBar; //導入方法依賴的package包/類
private PerspectivesPanelBar(Perspectives perspectives) {
setLayout(new GridBagLayout());
setOpaque(false);
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(1, 10, 2, 0);
JToolBar workspaceToolBar = perspectives.getWorkspaceToolBar();
workspaceToolBar.setBackground(getBackgroundColor());
add(workspaceToolBar, gbc);
}