本文整理汇总了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;
}