I am creating an app that uses an undecorated border and wanted to add a shadow to the my JFrame. I got the shadow working but in the process the text got all screwed up.
Due to the size of the program I can not post all of my code but the problem does go away when I remove this line. setBackground(new Color(0, 0, 0, 0)); So what could cause the text to display blurry and incorrectly? It is bolder and some of the letters seem to be taller. And I cannot post a picture since I do not have a level 10 reputation. Here is more of my code:
int extendBy=30;
setMaximumSize(new Dimension(width + extendBy, height + extendBy));
setMinimumSize(new Dimension(width + extendBy, height + extendBy));
setPreferredSize(new Dimension(width + extendBy, height + extendBy));
setUndecorated(true);
setBackground(new Color(0, 0, 0, 0)); // all hell breaks loose here
setContentPane(new ShadowPane());
getContentPane().setBackground(Color.BLACK);
setLocationRelativeTo(null);
setLayout(null); // I know setting null this is bad practice
edit: acquired 10 reputation so here is a pic (look at W or A or k):
Try to override the paintComponent method for this JTable.
How to do it: Overriding paintComponent
For Your case i would use anti-aliasing to get rid of those unwanted effects.
jTable1 = new javax.swing.JTable(){
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON );
}
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.