Eu tentei aqui com o um código antigo, realmente não funciona. Tentei dos dois jeitos e não funcionou. Note que o jeito que vc fez no exemplo um nunca funcionaria já que vc chama um método estático.
Mesmo assim, vou colocar o código aqui pra ver se foi alguma coisa que me escapou. Engraçado que o valor do botão cancela muda… estranho, alguma coisa “bypass” os settings do UIManager.
Alguém tem alguma idéia ???
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*
*
* @author Last modified by $Author$
* @version $Revision$
*/
public class InternalFrameDemo
extends JFrame
{
/** */
JDesktopPane desktop;
/**
* Creates a new InternalFrameDemo object.
*/
public InternalFrameDemo()
{
super("InternalFrameDemo");
//Make the big window be indented 50 pixels from each edge
//of the screen.
int inset = 50;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setBounds(inset, inset, screenSize.width - (inset * 2), screenSize.height - (inset * 2));
//Quit this app when the big window closes.
addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
//Set up the GUI.
desktop = new JDesktopPane(); //a specialized layered pane
createSelectNameWindow(); //Create first window
setContentPane(desktop);
setJMenuBar(createMenuBar());
//Make dragging faster:
desktop.putClientProperty("JDesktopPane.dragMode", "outline");
}
/**
*
*/
public static void main(String[] args)
{
UIManager.put("OptionPane.font", new Font("Arial Unicode MS", Font.PLAIN, 20));
UIManager.put("OptionPane.foreground", Color.red);
InternalFrameDemo frame = new InternalFrameDemo();
frame.checkFonts();
SwingUtilities.updateComponentTreeUI(frame);
frame.setVisible(true);
}
/**
*
*/
protected void createFrame()
{
JInternalFrame frame = new JInternalFrame("frame");
frame.setSize(300, 200);
frame.setVisible(true);
desktop.add(frame);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {
}
}
/**
*
*/
protected JMenuBar createMenuBar()
{
UIManager.put("OptionPane.font", new Font("Arial Unicode MS", Font.PLAIN, 20));
UIManager.put("OptionPane.foreground", Color.red);
UIManager.put("OptionPane.cancelButtonText", "New Cancel");
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Document");
menu.setMnemonic(KeyEvent.VK_D);
JMenuItem menuItem = new JMenuItem("New");
menuItem.setMnemonic(KeyEvent.VK_N);
menuItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
{
createFrame();
}
});
// using UIManager
JMenuItem optionItem = new JMenuItem("Option");
optionItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
{
JOptionPane.showConfirmDialog(
InternalFrameDemo.this, "Using UIDefaults", "Titulo",
JOptionPane.WARNING_MESSAGE);
}
});
//overriding...
JMenuItem option2Item = new JMenuItem("Option2");
JOptionPane optionPane = new JOptionPane("Using own option pane", JOptionPane.WARNING_MESSAGE);
optionPane.setFont(new Font("Arial Unicode MS", Font.PLAIN, 10));
optionPane.setForeground(Color.GREEN);
final JDialog dialog = optionPane.createDialog(this, "Titulo 2");
option2Item.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
{
dialog.show();
}
});
menu.add(menuItem);
menu.add(optionItem);
menu.add(option2Item);
menuBar.add(menu);
return menuBar;
}
/**
*
*/
protected void createSelectNameWindow()
{
SelectNameWindow snw = new SelectNameWindow("user_name");
desktop.add(snw);
snw.setVisible(true);
try {
snw.setSelected(true);
} catch (java.beans.PropertyVetoException e) {
}
}
/**
*
*
*
*/
protected void processKeyEvent(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
System.exit(0);
}
super.processKeyEvent(e);
}
/**
*
*/
private void checkFonts()
{
String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
boolean found = false;
for (int i = 0; i < fonts.length; i++) {
System.out.println(fonts[i]);
if (!found && fonts[i].equals("Arial Unicode MS")) {
System.out.println("found!!");
return;
}
}
}
}
Vou colocar la na sun tb, quem sabe alguém la sabe.