本文整理匯總了Java中javax.swing.UIManager.LookAndFeelInfo.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java LookAndFeelInfo.getName方法的具體用法?Java LookAndFeelInfo.getName怎麽用?Java LookAndFeelInfo.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.UIManager.LookAndFeelInfo
的用法示例。
在下文中一共展示了LookAndFeelInfo.getName方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
public static void main(final String[] args) throws Exception {
try {
createGUI();
for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
final String name = laf.getName();
if (name.contains("OS X") || name.contains("Metal")) {
SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
SwingUtilities.invokeAndWait(() -> {
for (int i = 0; i < 4000; ++i) {
SwingUtilities.updateComponentTreeUI(frame);
}
});
}
}
} finally {
if (frame != null) { EventQueue.invokeAndWait(() -> frame.dispose()); }
}
}
示例2: main
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
public static void main(final String[] args) throws Exception {
try {
createGUI();
for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
final String name = laf.getName();
if (name.contains("OS X") || name.contains("Metal")) {
SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
SwingUtilities.invokeAndWait(() -> {
for (int i = 0; i < 4000; ++i) {
SwingUtilities.updateComponentTreeUI(frame);
}
});
}
}
} finally {
EventQueue.invokeAndWait(() -> frame.dispose());
}
}
示例3: updateLookAndFeels
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
protected void updateLookAndFeels()
{
clearButtons();
LookAndFeel currentLookAndFeel = UIManager.getLookAndFeel();
String current = currentLookAndFeel == null ? "" : currentLookAndFeel.getName();
LookAndFeelInfo[] infoArray = UIManager.getInstalledLookAndFeels();
if (infoArray == null || infoArray.length == 0) {
return;
}
for (LookAndFeelInfo info : infoArray) {
JRadioButtonMenuItem button = new JRadioButtonMenuItem(info.getName());
button.setActionCommand(info.getClassName());
if (info.getName().equals(current))
button.setSelected(true);
addButton(button);
}
}
示例4: createThemeMenu
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
private JMenu createThemeMenu() {
JMenu menu = new JMenu("Theme");
ButtonGroup group = new ButtonGroup();
for (final LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
Action setLnF = new AbstractAction(info.getName()) {
@Override
public void actionPerformed(ActionEvent event) {
try {
UIManager.setLookAndFeel(info.getClassName());
SwingUtilities.updateComponentTreeUI(getRootPane());
} catch (Exception e) {
setStatus("red", "Failed to load {} LaF.", info.getName());
}
}
};
AbstractButton button = new JCheckBoxMenuItem(setLnF);
group.add(button);
menu.add(button);
}
return menu;
}
示例5: createLAFButtons
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
private static void createLAFButtons(final int lafIndex, final JFrame f, final JPanel radioPanel) {
final ButtonGroup bGroup = new ButtonGroup();
for (int i = 0; i < lafs.length; i++) {
final int index = i;
final LookAndFeelInfo laf = lafs[index];
String title = laf.getName();
if (index == systemLafIndex) {
title += " (system L&F)";
}
final JRadioButton lafButton = new JRadioButton(title);
if (index == lafIndex) {
lafButton.setSelected(true);
}
lafButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
updateLAF(index, f);
}
});
radioPanel.add(lafButton);
bGroup.add(lafButton);
}
}
示例6: createLookAndFeelMenuItems
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
/**
* Adds menu items to the given menu for each look and feel
* installed in the running vm.
*
* @param menu the menu to add the items to
*/
private void createLookAndFeelMenuItems(JMenu menu) {
LookAndFeel current = UIManager.getLookAndFeel();
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
JMenuItem mnuLaF = new JMenuItem(info.getName());
if (current.getClass().getName().equals(info.getClassName())) {
mnuLaF.setIcon(Icons.CHECK);
}
mnuLaF.setActionCommand("laf+" + info.getClassName());
mnuLaF.addActionListener(this);
menu.add(mnuLaF);
}
}
示例7: fillLAndFeelMenu
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
private void fillLAndFeelMenu() {
final LookAndFeelInfo plaf[] = UIManager.getInstalledLookAndFeels();
this.lookAndFeelMap = new HashMap<String, LookAndFeelInfo>();
final ButtonGroup lfGroup = new ButtonGroup();
final ActionListener lfListener = new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
final JRadioButtonMenuItem item = (JRadioButtonMenuItem) e.getSource();
setSelectedLookAndFeel(item.getText());
}
};
for (LookAndFeelInfo aPlaf : plaf) {
final String lfName = aPlaf.getName();
if (lfName.toLowerCase(Locale.ENGLISH).contains("nimbus")) {
continue;
}
lookAndFeelMap.put(lfName, aPlaf);
JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(lfName);
menuItem.addActionListener(lfListener);
lfGroup.add(menuItem);
menuLookAndFeel.add(menuItem);
}
}
示例8: createLookAndFeelMenuItems
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
/**
* Adds menu items to the given menu for each look and feel
* installed in the running vm.
* @param menu the menu to add the items to
*/
private void createLookAndFeelMenuItems(JMenu menu) {
LookAndFeel current = UIManager.getLookAndFeel();
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
JMenuItem mnuLaF = new JMenuItem(info.getName());
if (current.getClass().getName().equals(info.getClassName())) {
mnuLaF.setIcon(Icons.SELECTED);
}
mnuLaF.setActionCommand("laf+" + info.getClassName());
mnuLaF.addActionListener(this);
menu.add(mnuLaF);
}
}
示例9: ChangeLookAndFeelAction
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
ChangeLookAndFeelAction(CliGuiContext cliGuiCtx, LookAndFeelInfo lookAndFeelInfo) {
super(lookAndFeelInfo.getName());
this.cliGuiCtx = cliGuiCtx;
this.lookAndFeelInfo = lookAndFeelInfo;
}