Hej alle samemn jeg har problemer med at lave 2D Grafik i min java form.
JFrame oprettelse
- JFrame window = new JFrame(Title);
-
- getTitle = Title;
-
- if (MAX == true) {
- window.setExtendedState(window.MAXIMIZED_BOTH);
- }
-
- if (MAX == false) {
- window.setSize(size_1, size_2);
- }
-
- if (borderless == true) {
- window.setUndecorated(true);
-
- }
-
- if (borderless = false) {
-
- }
-
- p = new JPanel();
- p.add(new ZinXan_AQUA());
-
- window.add(p, BorderLayout.CENTER);
- window.setLocationRelativeTo(null);
- window.setVisible(vis);
Min class hvor jeg tegner :
- package GUI;
-
- import java.awt.*;
- import javax.swing.*;
-
- public class ZinXan_AQUA extends JPanel {
- private static final long serialVersionUID = 1L;
-
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
-
- Graphics2D g2d = (Graphics2D) g;
- g2d.drawString("Java 2D", 50, 50);
-
-
-
- }
-
- }
Tak på forhånd