Grafikfehler JFrame- Cleartype

thomasbomme

Mitglied
Ich mache gerade meine ersten Programme in Java mit dem Buch "Programmieren lernen mit Java" von Hans-Peter Habelitz

Nun habe ich folgendes Problem:

Ich arbeite mit dem Plug-in Jigloo, und möchte mit JFrame eine Grafikoberfläche erstellen. Dies funktioniert auch, solange ich bei Windows 7 Cleartype-Text ausgestellt habe ohne Probleme... sobald ich jedoch den Cleartype Text einschalte sehen die Grafiken komisch aus (siehe Bild)

Gibt es eine Möglichkeit dieses Problem zu beheben ohne jedesmal wenn ich etwas mit Java erstellen will vorher Cleartype manuell deaktivieren zu müssen?
vllt. kann ja Java Cleartype selber zeitweiße ausschalten oder es gibt eine andere Lösung

Danke im Vorraus - Thomas


grafikfehler.png


hier ein Beispielcode
Java:
package gui;
import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JToggleButton;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit [url=http://www.cloudgarden.com]Cloudgarden.com[/url] for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class jFrame01 extends javax.swing.JFrame {
	private JButton jButton1;
	private JTextArea jTextArea1;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				jFrame01 inst = new jFrame01();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public jFrame01() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				jTextArea1 = new JTextArea();
				getContentPane().add(jTextArea1);
				jTextArea1.setText("jTextArea1");
				jTextArea1.setBounds(235, 43, 87, 39);
			}
			{
				jButton1 = new JButton();
				getContentPane().add(jButton1);
				jButton1.setText("jButton1");
				jButton1.setBounds(51, 32, 149, 101);
			}
			pack();
			this.setSize(407, 213);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

}
 
Hey, ich antworte wahrscheinlich ein wenig spät, aber besser spät als nie 😉 .
Ich kann dir nicht genau sagen, warum die Grafiken so komisch dargestellt werden, aber vielleicht vertragen sich der Java Look und der Windows Cleartype Text einfach nicht...
Versuchs mal, indem du das LookAndFeel vom JFrame änderst, indem du den Befehl:
Java:
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
hinzufügst.

Achja und das mit deinem Code versteh ich nicht, wieso so umständlich, wenn man auch einfach:
Java:
import java.awt.*;
import javax.swing.*;

public class jFrame01 extends JFrame{
    Container c;
    JButton button;
    JTextArea area;
   
    public static void main(String[] args) {
        jFrame01 frame = new jFrame01();
        frame.setLocationRelativeTo(null);
        frame.setSize(407, 213);
        frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
    public jFrame01(){
        c = getContentPane();
        c.setLayout(null);
       
        button = new JButton("jButton1");
        button.setBounds(51, 32, 149, 101);
       
        area = new JTextArea("jTextArea1");
        area.setBounds(235, 43, 87, 39);
       
        c.add(button);
        c.add(area);
    }
}
schreiben kann 😉 .
Ich hoffe ich konnte dir helfen,
MfG ThePlayerYt.
 

Zurück
Oben