Hello, I think it is necessary to simply make use of the code below and then you will able to get the solution for your problem:
Code:
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 checker extends MetalLookAndFeel
{
protected void initSystemColorDefaults(UIDefaults default)
{
super.initSystemColorDefaults(default);
default.put("info", new ColorUIResource(255, 255, 225));
}
}
class test extends JFrame
{
public test() throws Exception
{
UIManager.setLookAndFeel("checker");
setLayout(new FlowLayout());
JButton b1 = new JButton();
b1.setText("<html>A<br> B</html>");
b1.setToolTipText("<html>C<br>D<br>E</html>");
add(b1);
JLabel l1 = new JLabel("Label");
l1.setToolTipText("set");
add(l1);
}
public static void main(String[] arg)throws Exception {
test obj = new test();
obj.setVisible(true);
obj.setSize(new Dimension(300, 150));
obj.validate();
}
}
Bookmarks