import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.metal.MetalLookAndFeel;
class MyLookAndFeel extends MetalLookAndFeel {
protected void initSystemColorDefaults(UIDefaults table) {
super.initSystemColorDefaults(table);
table.put("info", new ColorUIResource(255, 255, 225));
}
}
class Main extends JFrame {
public Main() throws Exception{
UIManager.setLookAndFeel("MyLookAndFeel");
setLayout(new FlowLayout());
JButton b = new JButton();
b.setText("<html>A<br> B</html>");
b.setToolTipText("<html>C<br>D<br>E</html>");
add(b);
JLabel l = new JLabel("Z");
l.setToolTipText("zzzzz...");
add(l);
}
public static void main(String[] arg)throws Exception {
Main m = new Main();
m.setVisible(true);
m.setSize(new Dimension(300, 150));
m.validate();
}
}
|