Luigi´s Blog
internet, počítače, politika, zdravie, hudba, poker, kurzové stávky, technika, marketing, filmy, seriály, zaujímavosti a iné
piatok 19. apríla 2013
sobota 9. marca 2013
Šťastná SE7MIČKA
P O S T U P
nový projekt Tvar.java
pridať JFrameForm JTvar.java
pridať JFrameForm JTvar.java
Tvar.java:
package xyz;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JComponent;
import java.awt.Graphics;
import javax.swing.JComponent;
public class Tvar extends JComponent{
public Tvar(){
setBounds(100, 100, 150, 150);
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.blue);
g.fillOval(0, 0, 100, 100);
}
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.blue);
g.fillOval(0, 0, 100, 100);
}
}
————————————————
JTvar.java:
package xyz;
public class JTvar extends javax.swing.JFrame {
Tvar tvar;
public Tvar() {
initComponents();
this.add(tvar = new Tvar());
initComponents();
this.add(tvar = new Tvar());
}
AUTOMATICKY GENEROVANÉ
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new JTvar().setVisible(true);
}
});
}
public void run() {
new JTvar().setVisible(true);
}
});
}
—————————————————————-
TROJUHOLNIK/SIPKA
int xPoints[] = new int[3];
int yPoints[] = new int[3];
int yPoints[] = new int[3];
xPoints[0] = 50;
xPoints[1] = 100;
xPoints[2] = 150;
xPoints[1] = 100;
xPoints[2] = 150;
yPoints[0] = 100;
yPoints[1] = 50;
yPoints[2] = 100;
g.fillPolygon(xPoints, yPoints, 3);
yPoints[1] = 50;
yPoints[2] = 100;
g.fillPolygon(xPoints, yPoints, 3);
——————————————————————–
public class JTvar extends javax.swing.JFrame implements MouseListener, MouseMotionListener
- implement all abstract methods
————————————————————————————————–
————————————————————————————————–
Prihlásiť na odber:
Komentáre (Atom)
.png)