Subtrees hinzugefügt
This commit is contained in:
parent
4304068dde
commit
d39f11aa33
583 changed files with 540980 additions and 0 deletions
6
Software/alg_oo_geoobjects/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
6
Software/alg_oo_geoobjects/01_GeoObject_Roh/01_geomobj_v0/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/01_GeoObject_Roh/01_geomobj_v0/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
//private ArrayList<GPoint> geoObjects = new ArrayList<GPoint>();
|
||||
//private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) { }
|
||||
|
||||
public void mouseReleased(MouseEvent e) { }
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) { }
|
||||
// Anfang Methoden
|
||||
public int getSelPtsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addNewCircle() { }
|
||||
|
||||
public void addNewRect() { }
|
||||
|
||||
public void addNewLine() { }
|
||||
|
||||
public void addNewPolygon() { }
|
||||
|
||||
public void setObjColor(Color newCol) { }
|
||||
|
||||
public void deleteObj() { }
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
/*for (GPoint p : geoObjects ) {
|
||||
p.draw(g);
|
||||
} // end of for */
|
||||
}
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 672;
|
||||
int frameHeight = 455;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,318 @@
|
|||
object geoObjGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_V1\GeoObGUI.jfm'
|
||||
ClientHeight = 427
|
||||
ClientWidth = 666
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
WindowState = wsMaximized
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
[Files]
|
||||
File0=Board.java
|
||||
File1=GeoObjGUI.java
|
||||
|
||||
[Box: - Board]
|
||||
X=364
|
||||
Y=94
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObjGUI]
|
||||
X=20
|
||||
Y=40
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=0
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Connections]
|
||||
V0=GeoObjGUI#Board#AssociationDirected####0#0#
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
|
||||
[Window]
|
||||
Left=100
|
||||
Top=18
|
||||
Width=1104
|
||||
Height=661
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=GeoObjGUI
|
||||
dependency1.to=Board
|
||||
dependency1.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=420
|
||||
editor.fx.0.y=157
|
||||
objectbench.height=93
|
||||
objectbench.width=427
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.6721311475409836
|
||||
package.editor.height=198
|
||||
package.editor.width=305
|
||||
package.editor.x=61
|
||||
package.editor.y=561
|
||||
package.frame.height=406
|
||||
package.frame.width=451
|
||||
package.numDependencies=1
|
||||
package.numTargets=2
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=130
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GeoObjGUI
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=10
|
||||
target2.y=90
|
||||
6
Software/alg_oo_geoobjects/01_GeoObject_Roh/02_geomobj_v1/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/01_GeoObject_Roh/02_geomobj_v1/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
private ArrayList<GPoint> geoObjects = new ArrayList<GPoint>();
|
||||
private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) { }
|
||||
|
||||
public void mouseReleased(MouseEvent e) { }
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) { }
|
||||
// Anfang Methoden
|
||||
public int getSelPtsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addNewCircle() { }
|
||||
|
||||
public void addNewRect() { }
|
||||
|
||||
public void addNewLine() { }
|
||||
|
||||
public void addNewPolygon() { }
|
||||
|
||||
public void setObjColor(Color newCol) { }
|
||||
|
||||
public void deleteObj() { }
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
for (GPoint p : geoObjects ) {
|
||||
p.draw(g);
|
||||
} // end of for
|
||||
}
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Beschreiben Sie hier die Klasse GPoint.
|
||||
*
|
||||
* @author (Ihr Name)
|
||||
* @version (eine Versionsnummer oder ein Datum)
|
||||
*/
|
||||
public class GPoint
|
||||
{
|
||||
public void draw (Graphics g)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 672;
|
||||
int frameHeight = 455;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,318 @@
|
|||
object drawItGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_V1\GeoObGUI.jfm'
|
||||
ClientHeight = 427
|
||||
ClientWidth = 666
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
WindowState = wsMaximized
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=GeoObjGUI
|
||||
dependency1.to=Board
|
||||
dependency1.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=964
|
||||
editor.fx.0.x=420
|
||||
editor.fx.0.y=157
|
||||
objectbench.height=93
|
||||
objectbench.width=473
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.6805111821086262
|
||||
package.editor.height=206
|
||||
package.editor.width=351
|
||||
package.editor.x=57
|
||||
package.editor.y=562
|
||||
package.frame.height=414
|
||||
package.frame.width=497
|
||||
package.numDependencies=1
|
||||
package.numTargets=3
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=130
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GPoint
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=160
|
||||
target2.y=100
|
||||
target3.height=70
|
||||
target3.name=GeoObjGUI
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=10
|
||||
target3.y=90
|
||||
6
Software/alg_oo_geoobjects/01_GeoObject_Roh/03_testklasse_gpoint/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/01_GeoObject_Roh/03_testklasse_gpoint/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
import java.awt.Color;
|
||||
|
||||
public class Testen_GPoint {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GPoint p1 = new GPoint(10,20);
|
||||
if (p1.getX()!=10 || p1.getY()!=20) {
|
||||
System.out.println("Die Startwerte f<>r x und y werden im Konstruktor nicht richtig gespeichert oder die get-Methoden funktionieren nicht.");
|
||||
} else {
|
||||
System.out.println("Die Startwerte f<>r x und y werden korrekt gespeichert und die get-Methoden funktionieren.");
|
||||
} // end of if
|
||||
|
||||
if (p1.getColor()==null || p1.getColor().getRGB() != Color.black.getRGB()) {
|
||||
System.out.println("Die Farbe sollte im Konstruktor auf Schwarz gesetzt werden.");
|
||||
} else {
|
||||
System.out.println("Die Farbe des Punktes wird im Konstruktor korrekt gesetzt.");
|
||||
} // end of if
|
||||
|
||||
p1.setX(43);
|
||||
p1.setY(12);
|
||||
if (p1.getX()!=43 || p1.getY()!=12) {
|
||||
System.out.println("Die set-Methoden arbeiten nicht richtig.");
|
||||
} else {
|
||||
System.out.println("Die set-Methoden funktionieren.");
|
||||
} // end of if
|
||||
|
||||
boolean abstand = true;
|
||||
if (p1.abstandZu(53,12)!=10) {
|
||||
System.out.println("Abstandberechnung funktioniert nicht.");
|
||||
abstand = false;
|
||||
} // end of if
|
||||
if (p1.abstandZu(43,2)!=10) {
|
||||
System.out.println("Abstandberechnung funktioniert nicht.");
|
||||
abstand = false;
|
||||
} // end of if
|
||||
if (p1.abstandZu(46,16)!=5) {
|
||||
System.out.println("Abstandberechnung funktioniert nicht.");
|
||||
abstand = false;
|
||||
} // end of if
|
||||
if (abstand) {
|
||||
System.out.println("Abstandsberechnungen funktionieren.");
|
||||
} // end of if
|
||||
} // end of main
|
||||
|
||||
} // end of class Testen
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_A/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_A/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 06.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x;
|
||||
private int y;
|
||||
private Color color;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
gr.drawRect(x-2,y-2,5,5);
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
[Files]
|
||||
File0=GPoint.java
|
||||
|
||||
[Box: - GPoint]
|
||||
X=40
|
||||
Y=41
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=2
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
|
||||
[Window]
|
||||
Left=50
|
||||
Top=50
|
||||
Width=1100
|
||||
Height=450
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#BlueJ package file
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=420
|
||||
editor.fx.0.y=157
|
||||
objectbench.height=66
|
||||
objectbench.width=428
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.6826086956521739
|
||||
package.editor.height=150
|
||||
package.editor.width=306
|
||||
package.editor.x=74
|
||||
package.editor.y=640
|
||||
package.frame.height=331
|
||||
package.frame.width=452
|
||||
package.numDependencies=0
|
||||
package.numTargets=1
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=GPoint
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=70
|
||||
target1.y=10
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_B/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_B/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 06.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x;
|
||||
private int y;
|
||||
private Color color;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
gr.drawRect(x-2,y-2,5,5);
|
||||
}
|
||||
|
||||
public double abstandZu(int mx, int my) {
|
||||
int dx = mx - x;
|
||||
int dy = my - y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
[Files]
|
||||
File0=GPoint.java
|
||||
|
||||
[Box: - GPoint]
|
||||
X=40
|
||||
Y=41
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=2
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
I1=GPoint gPoint1 = new GPoint(100, 80);
|
||||
I2=gPoint1.abstandZu(120, 110);
|
||||
|
||||
[Window]
|
||||
Left=25
|
||||
Top=25
|
||||
Width=1125
|
||||
Height=417
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#BlueJ package file
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=420
|
||||
editor.fx.0.y=157
|
||||
objectbench.height=66
|
||||
objectbench.width=374
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.6711711711711712
|
||||
package.editor.height=142
|
||||
package.editor.width=252
|
||||
package.editor.x=66
|
||||
package.editor.y=642
|
||||
package.frame.height=323
|
||||
package.frame.width=398
|
||||
package.numDependencies=0
|
||||
package.numTargets=1
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=GPoint
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=70
|
||||
target1.y=10
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_C/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_C/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
private ArrayList<GPoint> geoObjects = new ArrayList<GPoint>();
|
||||
private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
GPoint p = new GPoint(100, 100);
|
||||
geoObjects.add(p);
|
||||
p = new GPoint(140, 120);
|
||||
geoObjects.add(p);
|
||||
p = new GPoint(240, 120);
|
||||
geoObjects.add(p);
|
||||
p = new GPoint(170, 130);
|
||||
geoObjects.add(p);
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) { }
|
||||
|
||||
public void mouseReleased(MouseEvent e) { }
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) { }
|
||||
// Anfang Methoden
|
||||
public int getSelPtsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addNewCircle() { }
|
||||
|
||||
public void addNewRect() { }
|
||||
|
||||
public void addNewLine() { }
|
||||
|
||||
public void addNewPolygon() { }
|
||||
|
||||
public void setObjColor(Color newCol) { }
|
||||
|
||||
public void deleteObj() { }
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
for (GPoint p : geoObjects ) {
|
||||
p.draw(g);
|
||||
} // end of for
|
||||
}
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 06.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x;
|
||||
private int y;
|
||||
private Color color;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
gr.drawRect(x-2,y-2,5,5);
|
||||
}
|
||||
|
||||
public double abstandZu(int mx, int my) {
|
||||
int dx = mx - x;
|
||||
int dy = my - y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
[Files]
|
||||
File0=Board.java
|
||||
File1=GeoObjGUI.java
|
||||
File2=GPoint.java
|
||||
|
||||
[Box: - Board]
|
||||
X=380
|
||||
Y=134
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObjGUI]
|
||||
X=24
|
||||
Y=18
|
||||
MinVis=0
|
||||
|
||||
[Box: - GPoint]
|
||||
X=70
|
||||
Y=326
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=2
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Connections]
|
||||
V0=Board#GPoint#Aggregation####0#0#
|
||||
V1=GeoObjGUI#Board#Aggregation####0#0#
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
I1=
|
||||
|
||||
[Window]
|
||||
Left=100
|
||||
Top=100
|
||||
Width=1125
|
||||
Height=417
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 672;
|
||||
int frameHeight = 455;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,318 @@
|
|||
object geoObjGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_B\GeoObjtGUI.jfm'
|
||||
ClientHeight = 427
|
||||
ClientWidth = 666
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
WindowState = wsMaximized
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=Board
|
||||
dependency1.to=GPoint
|
||||
dependency1.type=UsesDependency
|
||||
dependency2.from=GeoObjGUI
|
||||
dependency2.to=Board
|
||||
dependency2.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=420
|
||||
editor.fx.0.y=157
|
||||
objectbench.height=66
|
||||
objectbench.width=475
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.75
|
||||
package.editor.height=212
|
||||
package.editor.width=353
|
||||
package.editor.x=83
|
||||
package.editor.y=575
|
||||
package.frame.height=393
|
||||
package.frame.width=499
|
||||
package.numDependencies=2
|
||||
package.numTargets=3
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=100
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GPoint
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=190
|
||||
target2.y=110
|
||||
target3.height=70
|
||||
target3.name=GeoObjGUI
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=20
|
||||
target3.y=100
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_D/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_D/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
private ArrayList<GPoint> geoObjects = new ArrayList<GPoint>();
|
||||
private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
GPoint p = new GPoint(100, 100);
|
||||
geoObjects.add(p);
|
||||
p = new GPoint(140, 120);
|
||||
geoObjects.add(p);
|
||||
p = new GPoint(240, 120);
|
||||
geoObjects.add(p);
|
||||
p = new GPoint(170, 130);
|
||||
geoObjects.add(p);
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
GPoint newP = new GPoint(e.getX(), e.getY());
|
||||
geoObjects.add(newP);
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) { }
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) { }
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public int getSelPtsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addNewCircle() { }
|
||||
|
||||
public void addNewRect() { }
|
||||
|
||||
public void addNewLine() { }
|
||||
|
||||
public void addNewPolygon() { }
|
||||
|
||||
public void setObjColor(Color newCol) { }
|
||||
|
||||
public void deleteObj() { }
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
for (GPoint p : geoObjects ) {
|
||||
p.draw(g);
|
||||
} // end of for
|
||||
}
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 06.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x;
|
||||
private int y;
|
||||
private Color color;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
gr.drawRect(x-2,y-2,5,5);
|
||||
}
|
||||
|
||||
public double abstandZu(int mx, int my) {
|
||||
int dx = mx - x;
|
||||
int dy = my - y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
[Files]
|
||||
File0=Board.java
|
||||
File1=GeoObjGUI.java
|
||||
File2=GPoint.java
|
||||
|
||||
[Box: - Board]
|
||||
X=397
|
||||
Y=130
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObjGUI]
|
||||
X=21
|
||||
Y=21
|
||||
MinVis=0
|
||||
|
||||
[Box: - GPoint]
|
||||
X=78
|
||||
Y=334
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=2
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Connections]
|
||||
V0=Board#GPoint#Aggregation####0#0#
|
||||
V1=GeoObjGUI#Board#AssociationDirected####0#0#
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
I1=
|
||||
I2=
|
||||
|
||||
[Window]
|
||||
Left=25
|
||||
Top=25
|
||||
Width=1125
|
||||
Height=417
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 672;
|
||||
int frameHeight = 455;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
object geoObjGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_C\GeoObGUI.jfm'
|
||||
ClientHeight = 427
|
||||
ClientWidth = 666
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=GeoObjGUI
|
||||
dependency1.to=Board
|
||||
dependency1.type=UsesDependency
|
||||
dependency2.from=Board
|
||||
dependency2.to=GPoint
|
||||
dependency2.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=171
|
||||
editor.fx.0.y=202
|
||||
objectbench.height=66
|
||||
objectbench.width=455
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.7411347517730497
|
||||
package.editor.height=202
|
||||
package.editor.width=333
|
||||
package.editor.x=65
|
||||
package.editor.y=588
|
||||
package.frame.height=383
|
||||
package.frame.width=479
|
||||
package.numDependencies=2
|
||||
package.numTargets=3
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=90
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GPoint
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=170
|
||||
target2.y=100
|
||||
target3.height=70
|
||||
target3.name=GeoObjGUI
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=10
|
||||
target3.y=90
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_E/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_E/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
private ArrayList<GPoint> geoObjects = new ArrayList<GPoint>();
|
||||
private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
GPoint p = new GPoint(100, 100);
|
||||
geoObjects.add(p);
|
||||
p = new GPoint(140, 120);
|
||||
geoObjects.add(p);
|
||||
p = new GPoint(240, 120);
|
||||
geoObjects.add(p);
|
||||
p = new GPoint(170, 130);
|
||||
geoObjects.add(p);
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
for (GPoint p : geoObjects) {
|
||||
double d = p.abstandZu(e.getX(), e.getY());
|
||||
if (d < 4) {
|
||||
dragPoint = p;
|
||||
} // end of if
|
||||
} // end of for
|
||||
if (dragPoint == null) {
|
||||
GPoint newP = new GPoint(e.getX(), e.getY());
|
||||
geoObjects.add(newP);
|
||||
repaint();
|
||||
} // end of if
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (dragPoint != null) {
|
||||
dragPoint.setX(e.getX());
|
||||
dragPoint.setY(e.getY());
|
||||
repaint();
|
||||
} // end of if
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getSelPtsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addNewCircle() { }
|
||||
|
||||
public void addNewRect() { }
|
||||
|
||||
public void addNewLine() { }
|
||||
|
||||
public void addNewPolygon() { }
|
||||
|
||||
public void setObjColor(Color newCol) { }
|
||||
|
||||
public void deleteObj() { }
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
for (GPoint p : geoObjects ) {
|
||||
p.draw(g);
|
||||
} // end of for
|
||||
}
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 06.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x;
|
||||
private int y;
|
||||
private Color color;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
gr.drawRect(x-2,y-2,5,5);
|
||||
}
|
||||
|
||||
public double abstandZu(int mx, int my) {
|
||||
int dx = mx - x;
|
||||
int dy = my - y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
[Files]
|
||||
File0=Board.java
|
||||
File1=GeoObjGUI.java
|
||||
File2=GPoint.java
|
||||
|
||||
[Box: - Board]
|
||||
X=401
|
||||
Y=121
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObjGUI]
|
||||
X=38
|
||||
Y=27
|
||||
MinVis=0
|
||||
|
||||
[Box: - GPoint]
|
||||
X=107
|
||||
Y=355
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=0
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Connections]
|
||||
V0=Board#GPoint#Aggregation####0#0#
|
||||
V1=GeoObjGUI#Board#Aggregation####0#0#
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
|
||||
[Window]
|
||||
Left=150
|
||||
Top=150
|
||||
Width=1125
|
||||
Height=417
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 672;
|
||||
int frameHeight = 455;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
object geoObjGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_D\GeoObGUI.jfm'
|
||||
ClientHeight = 427
|
||||
ClientWidth = 666
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=Board
|
||||
dependency1.to=GPoint
|
||||
dependency1.type=UsesDependency
|
||||
dependency2.from=GeoObjGUI
|
||||
dependency2.to=Board
|
||||
dependency2.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=234
|
||||
editor.fx.0.y=205
|
||||
objectbench.height=66
|
||||
objectbench.width=457
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.7402135231316725
|
||||
package.editor.height=201
|
||||
package.editor.width=335
|
||||
package.editor.x=68
|
||||
package.editor.y=588
|
||||
package.frame.height=382
|
||||
package.frame.width=481
|
||||
package.numDependencies=2
|
||||
package.numTargets=3
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=100
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GPoint
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=180
|
||||
target2.y=100
|
||||
target3.height=70
|
||||
target3.name=GeoObjGUI
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=20
|
||||
target3.y=90
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_F/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_F/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
private ArrayList<GeoObject> geoObjects = new ArrayList<GeoObject>();
|
||||
private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
geoObjects.add(new GPoint(100, 100));
|
||||
geoObjects.add(new GPoint(140, 120));
|
||||
GPoint p3 = new GPoint(240, 120);
|
||||
geoObjects.add(p3);
|
||||
GPoint p4 = new GPoint(170, 130);
|
||||
geoObjects.add(p4);
|
||||
geoObjects.add(new GLine(p3, p4));
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
for (GeoObject go : geoObjects) {
|
||||
if (go instanceof GPoint) {
|
||||
GPoint p = (GPoint) go;
|
||||
double d = p.abstandZu(e.getX(), e.getY());
|
||||
if (d < 4) {
|
||||
dragPoint = p;
|
||||
} // end of if
|
||||
} // end of if
|
||||
} // end of for
|
||||
if (dragPoint == null) {
|
||||
GPoint newP = new GPoint(e.getX(), e.getY());
|
||||
geoObjects.add(newP);
|
||||
repaint();
|
||||
} // end of if
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (dragPoint != null) {
|
||||
if (Math.abs(dragPoint.getX()-e.getX())>0 || Math.abs(dragPoint.getY()-e.getY())>0) {
|
||||
dragPoint.setX(e.getX());
|
||||
dragPoint.setY(e.getY());
|
||||
repaint();
|
||||
} // end of if
|
||||
} // end of if
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public int getSelPtsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addNewCircle() { }
|
||||
|
||||
public void addNewRect() { }
|
||||
|
||||
public void addNewLine() { }
|
||||
|
||||
public void addNewPolygon() { }
|
||||
|
||||
public void setObjColor(Color newCol) { }
|
||||
|
||||
public void deleteObj() { }
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
for (GeoObject go : geoObjects ) {
|
||||
go.draw(g);
|
||||
} // end of for
|
||||
}
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 23.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class GLine extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private GPoint point1 = null;
|
||||
private GPoint point2 = null;
|
||||
// Ende Attribute
|
||||
|
||||
public GLine(GPoint point1, GPoint point2) {
|
||||
super();
|
||||
this.point1 = point1;
|
||||
this.point2 = point2;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public void draw(Graphics gr) {
|
||||
gr.drawLine(point1.getX(),point1.getY(),point2.getX(), point2.getY());
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GLine
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 06.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x;
|
||||
private int y;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
gr.drawRect(x-2,y-2,5,5);
|
||||
}
|
||||
|
||||
public double abstandZu(int mx, int my) {
|
||||
int dx = mx - x;
|
||||
int dy = my - y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
[Files]
|
||||
File0=Board.java
|
||||
File1=GeoObject.java
|
||||
File2=GeoObjGUI.java
|
||||
File3=GLine.java
|
||||
File4=GPoint.java
|
||||
|
||||
[Box: - Board]
|
||||
X=431
|
||||
Y=143
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObject]
|
||||
X=150
|
||||
Y=328
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObjGUI]
|
||||
X=16
|
||||
Y=14
|
||||
MinVis=0
|
||||
|
||||
[Box: - GLine]
|
||||
X=299
|
||||
Y=531
|
||||
MinVis=0
|
||||
|
||||
[Box: - GPoint]
|
||||
X=26
|
||||
Y=492
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=137
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=2
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Connections]
|
||||
V0=Board#GeoObject#Aggregation####0#0#
|
||||
V1=GeoObjGUI#Board#Aggregation####0#0#
|
||||
V2=GLine#GPoint#AssociationDirected####0#0#
|
||||
V3=Board#GPoint#AssociationDirected####0#0#
|
||||
V4=GLine#GeoObject#Inheritends####0#0#
|
||||
V5=GPoint#GeoObject#Inheritends####0#0#
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
I1=
|
||||
I2=
|
||||
|
||||
[Window]
|
||||
Left=175
|
||||
Top=175
|
||||
Width=1125
|
||||
Height=417
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 669;
|
||||
int frameHeight = 454;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
object geoObjGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 2
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_E\GeoObGUI.jfm'
|
||||
ClientHeight = 426
|
||||
ClientWidth = 663
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 22.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public abstract class GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private Color color;
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObject() {
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public abstract void draw(Graphics gr);
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GeoObject
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=Board
|
||||
dependency1.to=GeoObject
|
||||
dependency1.type=UsesDependency
|
||||
dependency2.from=Board
|
||||
dependency2.to=GPoint
|
||||
dependency2.type=UsesDependency
|
||||
dependency3.from=Board
|
||||
dependency3.to=GLine
|
||||
dependency3.type=UsesDependency
|
||||
dependency4.from=GeoObjGUI
|
||||
dependency4.to=Board
|
||||
dependency4.type=UsesDependency
|
||||
dependency5.from=GLine
|
||||
dependency5.to=GPoint
|
||||
dependency5.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=420
|
||||
editor.fx.0.y=157
|
||||
objectbench.height=66
|
||||
objectbench.width=623
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.8142493638676844
|
||||
package.editor.height=313
|
||||
package.editor.width=501
|
||||
package.editor.x=71
|
||||
package.editor.y=470
|
||||
package.frame.height=494
|
||||
package.frame.width=647
|
||||
package.numDependencies=5
|
||||
package.numTargets=5
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=90
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GLine
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=340
|
||||
target2.y=150
|
||||
target3.height=70
|
||||
target3.name=GeoObject
|
||||
target3.showInterface=false
|
||||
target3.type=AbstractTarget
|
||||
target3.width=120
|
||||
target3.x=180
|
||||
target3.y=100
|
||||
target4.height=70
|
||||
target4.name=GPoint
|
||||
target4.showInterface=false
|
||||
target4.type=ClassTarget
|
||||
target4.width=120
|
||||
target4.x=170
|
||||
target4.y=210
|
||||
target5.height=70
|
||||
target5.name=GeoObjGUI
|
||||
target5.showInterface=false
|
||||
target5.type=ClassTarget
|
||||
target5.width=120
|
||||
target5.x=10
|
||||
target5.y=100
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_G/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_G/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
private ArrayList<GeoObject> geoObjects = new ArrayList<GeoObject>();
|
||||
private ArrayList<GPoint> selectedPts = new ArrayList<GPoint>();
|
||||
private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
geoObjects.add(new GPoint(100, 100));
|
||||
geoObjects.add(new GPoint(140, 120));
|
||||
GPoint p3 = new GPoint(240, 120);
|
||||
geoObjects.add(p3);
|
||||
GPoint p4 = new GPoint(170, 130);
|
||||
geoObjects.add(p4);
|
||||
geoObjects.add(new GLine(p3, p4));
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
for (GeoObject go : geoObjects) {
|
||||
if (go instanceof GPoint) {
|
||||
GPoint p = (GPoint) go;
|
||||
double d = p.abstandZu(e.getX(), e.getY());
|
||||
if (d < 5) {
|
||||
dragPoint = p;
|
||||
} // end of if
|
||||
} // end of if
|
||||
} // end of for
|
||||
if (dragPoint == null) {
|
||||
GPoint newP = new GPoint(e.getX(), e.getY());
|
||||
geoObjects.add(newP);
|
||||
repaint();
|
||||
} else {
|
||||
if ((e.getModifiersEx() & e.SHIFT_DOWN_MASK) > 0) {
|
||||
if (dragPoint.getSelected()) {
|
||||
dragPoint.setSelected(false);
|
||||
selectedPts.remove(dragPoint);
|
||||
} else {
|
||||
dragPoint.setSelected(true);
|
||||
selectedPts.add(dragPoint);
|
||||
}// end of if
|
||||
repaint();
|
||||
} // end of if
|
||||
}// end of if
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (dragPoint != null) {
|
||||
if (Math.abs(dragPoint.getX()-e.getX())>0 || Math.abs(dragPoint.getY()-e.getY())>0) {
|
||||
dragPoint.setX(e.getX());
|
||||
dragPoint.setY(e.getY());
|
||||
repaint();
|
||||
} // end of if
|
||||
} // end of if
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public int getSelPtsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void addNewCircle() { }
|
||||
|
||||
public void addNewRect() { }
|
||||
|
||||
public void addNewLine() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GLine line = new GLine(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(line);
|
||||
} // end of if
|
||||
for (GPoint p: selectedPts) {
|
||||
p.setSelected(false);
|
||||
} // end of for
|
||||
selectedPts.clear();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewPolygon() { }
|
||||
|
||||
public void setObjColor(Color newCol) { }
|
||||
|
||||
public void deleteObj() { }
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
for (GeoObject go : geoObjects ) {
|
||||
go.draw(g);
|
||||
} // end of for
|
||||
}
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 23.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class GLine extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private GPoint point1 = null;
|
||||
private GPoint point2 = null;
|
||||
// Ende Attribute
|
||||
|
||||
public GLine(GPoint point1, GPoint point2) {
|
||||
super();
|
||||
this.point1 = point1;
|
||||
this.point2 = point2;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public void draw(Graphics gr) {
|
||||
gr.drawLine(point1.getX(),point1.getY(),point2.getX(), point2.getY());
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GLine
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 30.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x = 10;
|
||||
private int y = 15;
|
||||
private boolean selected;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public boolean getSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
if (selected) {
|
||||
gr.fillRect(x-2, y-2, 5, 5);
|
||||
} // end of if
|
||||
gr.drawRect(x-2, y-2, 5, 5);
|
||||
}
|
||||
|
||||
public double abstandZu(int mx, int my) {
|
||||
int dx = mx - x;
|
||||
int dy = my - y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
[Files]
|
||||
File0=Board.java
|
||||
File1=GeoObject.java
|
||||
File2=GeoObjGUI.java
|
||||
File3=GLine.java
|
||||
File4=GPoint.java
|
||||
|
||||
[Box: - Board]
|
||||
X=431
|
||||
Y=143
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObject]
|
||||
X=150
|
||||
Y=328
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObjGUI]
|
||||
X=16
|
||||
Y=14
|
||||
MinVis=0
|
||||
|
||||
[Box: - GLine]
|
||||
X=287
|
||||
Y=549
|
||||
MinVis=0
|
||||
|
||||
[Box: - GPoint]
|
||||
X=26
|
||||
Y=492
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=2
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Connections]
|
||||
V0=Board#GeoObject#AssociationDirected####0#0#
|
||||
V1=GeoObjGUI#Board#AssociationDirected####0#0#
|
||||
V2=GLine#GPoint#AssociationDirected####0#0#
|
||||
V3=Board#GPoint#AssociationDirected####0#0#
|
||||
V4=GLine#GeoObject#Inheritends####0#0#
|
||||
V5=GPoint#GeoObject#Inheritends####0#0#
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
|
||||
[Window]
|
||||
Left=75
|
||||
Top=75
|
||||
Width=1125
|
||||
Height=417
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 669;
|
||||
int frameHeight = 454;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
object geoObjGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 2
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_E\GeoObGUI.jfm'
|
||||
ClientHeight = 426
|
||||
ClientWidth = 663
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 22.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private Color color = null;
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObject() {
|
||||
super();
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public abstract void draw(Graphics gr);
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GeoObject
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=GeoObjGUI
|
||||
dependency1.to=Board
|
||||
dependency1.type=UsesDependency
|
||||
dependency2.from=Board
|
||||
dependency2.to=GeoObject
|
||||
dependency2.type=UsesDependency
|
||||
dependency3.from=Board
|
||||
dependency3.to=GPoint
|
||||
dependency3.type=UsesDependency
|
||||
dependency4.from=Board
|
||||
dependency4.to=GLine
|
||||
dependency4.type=UsesDependency
|
||||
dependency5.from=GLine
|
||||
dependency5.to=GPoint
|
||||
dependency5.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=194
|
||||
editor.fx.0.y=199
|
||||
objectbench.height=66
|
||||
objectbench.width=630
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.818407960199005
|
||||
package.editor.height=322
|
||||
package.editor.width=508
|
||||
package.editor.x=62
|
||||
package.editor.y=469
|
||||
package.frame.height=503
|
||||
package.frame.width=654
|
||||
package.numDependencies=5
|
||||
package.numTargets=5
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=90
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GLine
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=340
|
||||
target2.y=150
|
||||
target3.height=70
|
||||
target3.name=GeoObject
|
||||
target3.showInterface=false
|
||||
target3.type=AbstractTarget
|
||||
target3.width=120
|
||||
target3.x=180
|
||||
target3.y=100
|
||||
target4.height=70
|
||||
target4.name=GPoint
|
||||
target4.showInterface=false
|
||||
target4.type=ClassTarget
|
||||
target4.width=120
|
||||
target4.x=180
|
||||
target4.y=210
|
||||
target5.height=70
|
||||
target5.name=GeoObjGUI
|
||||
target5.showInterface=false
|
||||
target5.type=ClassTarget
|
||||
target5.width=120
|
||||
target5.x=10
|
||||
target5.y=90
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_H/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_H/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
protected ArrayList<GeoObject> geoObjects = new ArrayList<GeoObject>();
|
||||
private ArrayList<GPoint> selectedPts = new ArrayList<GPoint>();
|
||||
private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
geoObjects.add(new GPoint(100, 100));
|
||||
geoObjects.add(new GPoint(140, 120));
|
||||
GPoint p3 = new GPoint(240, 120);
|
||||
geoObjects.add(p3);
|
||||
GPoint p4 = new GPoint(170, 130);
|
||||
geoObjects.add(p4);
|
||||
geoObjects.add(new GLine(p3, p4));
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
for (GeoObject go : geoObjects) {
|
||||
if (go instanceof GPoint) {
|
||||
GPoint p = (GPoint) go;
|
||||
double d = p.abstandZu(e.getX(), e.getY());
|
||||
if (d < 5) {
|
||||
dragPoint = p;
|
||||
} // end of if
|
||||
} // end of if
|
||||
} // end of for
|
||||
if (dragPoint == null) {
|
||||
GPoint newP = new GPoint(e.getX(), e.getY());
|
||||
geoObjects.add(newP);
|
||||
repaint();
|
||||
} else {
|
||||
if ((e.getModifiersEx() & e.SHIFT_DOWN_MASK) > 0) {
|
||||
if (dragPoint.getSelected()) {
|
||||
dragPoint.setSelected(false);
|
||||
selectedPts.remove(dragPoint);
|
||||
} else {
|
||||
dragPoint.setSelected(true);
|
||||
selectedPts.add(dragPoint);
|
||||
}// end of if
|
||||
repaint();
|
||||
} // end of if
|
||||
}// end of if
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (dragPoint != null) {
|
||||
if (Math.abs(dragPoint.getX()-e.getX())>0 || Math.abs(dragPoint.getY()-e.getY())>0) {
|
||||
dragPoint.setX(e.getX());
|
||||
dragPoint.setY(e.getY());
|
||||
repaint();
|
||||
} // end of if
|
||||
} // end of if
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public int getSelPtsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void clearSelectedPts() {
|
||||
for (GPoint p: selectedPts) {
|
||||
p.setSelected(false);
|
||||
} // end of for
|
||||
selectedPts.clear();
|
||||
}
|
||||
|
||||
public void addNewCircle() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GCircle circle = new GCircle(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(circle);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewRect() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GRectangle rectangle = new GRectangle(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(rectangle);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewLine() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GLine line = new GLine(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(line);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewPolygon() { }
|
||||
|
||||
public void setObjColor(Color newCol) { }
|
||||
|
||||
public void deleteObj() { }
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
for (GeoObject go : geoObjects ) {
|
||||
go.draw(g);
|
||||
} // end of for
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 04.10.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GCircle extends GLine {
|
||||
|
||||
// Anfang Attribute
|
||||
// Ende Attribute
|
||||
|
||||
public GCircle(GPoint point1, GPoint point2) {
|
||||
super(point1, point2);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
private int getRadius() {
|
||||
int dx = point2.getX() - point1.getX();
|
||||
int dy = point2.getY() - point1.getY();
|
||||
double r = Math.sqrt(dx * dx + dy * dy);
|
||||
return (int) Math.round(r);
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
int r = getRadius();
|
||||
int mx = point1.getX();
|
||||
int my = point1.getY();
|
||||
gr.drawOval(mx - r, my - r, 2*r, 2*r);
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GCircle
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 23.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class GLine extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
protected GPoint point1 = null;
|
||||
protected GPoint point2 = null;
|
||||
// Ende Attribute
|
||||
|
||||
public GLine(GPoint point1, GPoint point2) {
|
||||
super();
|
||||
this.point1 = point1;
|
||||
this.point2 = point2;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public void draw(Graphics gr) {
|
||||
gr.drawLine(point1.getX(),point1.getY(),point2.getX(), point2.getY());
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GLine
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 30.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x = 10;
|
||||
private int y = 15;
|
||||
private boolean selected;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public boolean getSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
if (selected) {
|
||||
gr.fillRect(x-2, y-2, 5, 5);
|
||||
} // end of if
|
||||
gr.drawRect(x-2, y-2, 5, 5);
|
||||
}
|
||||
|
||||
public double abstandZu(int mx, int my) {
|
||||
int dx = mx - x;
|
||||
int dy = my - y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 04.10.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GRectangle extends GLine {
|
||||
|
||||
// Anfang Attribute
|
||||
// Ende Attribute
|
||||
|
||||
public GRectangle(GPoint point1, GPoint point2) {
|
||||
super(point1, point2);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public void draw(Graphics gr) {
|
||||
int lox = Math.min(point1.getX(), point2.getX());
|
||||
int loy = Math.min(point1.getY(), point2.getY());
|
||||
int dx = Math.abs(point2.getX() - point1.getX());
|
||||
int dy = Math.abs(point2.getY() - point1.getY());
|
||||
gr.drawRect(lox, loy, dx, dy);
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GRectangle
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
[Files]
|
||||
File0=Board.java
|
||||
File1=GCircle.java
|
||||
File2=GeoObject.java
|
||||
File3=GeoObjGUI.java
|
||||
File4=GLine.java
|
||||
File5=GPoint.java
|
||||
File6=GRectangle.java
|
||||
|
||||
[Box: - Board]
|
||||
X=431
|
||||
Y=143
|
||||
MinVis=0
|
||||
|
||||
[Box: - GCircle]
|
||||
X=151
|
||||
Y=723
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObject]
|
||||
X=153
|
||||
Y=320
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObjGUI]
|
||||
X=16
|
||||
Y=14
|
||||
MinVis=0
|
||||
|
||||
[Box: - GLine]
|
||||
X=287
|
||||
Y=549
|
||||
MinVis=0
|
||||
|
||||
[Box: - GPoint]
|
||||
X=26
|
||||
Y=492
|
||||
MinVis=0
|
||||
|
||||
[Box: - GRectangle]
|
||||
X=421
|
||||
Y=723
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=0
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=2
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Connections]
|
||||
V0=Board#GeoObject#AssociationDirected####0#0#
|
||||
V1=GeoObjGUI#Board#AssociationDirected####0#0#
|
||||
V2=GLine#GPoint#AssociationDirected####0#0#
|
||||
V3=Board#GPoint#AssociationDirected####0#0#
|
||||
V4=GCircle#GLine#Inheritends####0#0#
|
||||
V5=GLine#GeoObject#Inheritends####0#0#
|
||||
V6=GPoint#GeoObject#Inheritends####0#0#
|
||||
V7=GRectangle#GLine#Inheritends####0#0#
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
I1=
|
||||
|
||||
[Window]
|
||||
Left=75
|
||||
Top=75
|
||||
Width=1129
|
||||
Height=421
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 669;
|
||||
int frameHeight = 454;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
object geoObjGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 2
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_E\GeoObGUI.jfm'
|
||||
ClientHeight = 426
|
||||
ClientWidth = 663
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 22.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private Color color;
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObject() {
|
||||
super();
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public abstract void draw(Graphics gr);
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GeoObject
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=GLine
|
||||
dependency1.to=GPoint
|
||||
dependency1.type=UsesDependency
|
||||
dependency2.from=GRectangle
|
||||
dependency2.to=GPoint
|
||||
dependency2.type=UsesDependency
|
||||
dependency3.from=GeoObjGUI
|
||||
dependency3.to=Board
|
||||
dependency3.type=UsesDependency
|
||||
dependency4.from=GCircle
|
||||
dependency4.to=GPoint
|
||||
dependency4.type=UsesDependency
|
||||
dependency5.from=Board
|
||||
dependency5.to=GeoObject
|
||||
dependency5.type=UsesDependency
|
||||
dependency6.from=Board
|
||||
dependency6.to=GPoint
|
||||
dependency6.type=UsesDependency
|
||||
dependency7.from=Board
|
||||
dependency7.to=GLine
|
||||
dependency7.type=UsesDependency
|
||||
dependency8.from=Board
|
||||
dependency8.to=GCircle
|
||||
dependency8.type=UsesDependency
|
||||
dependency9.from=Board
|
||||
dependency9.to=GRectangle
|
||||
dependency9.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=132
|
||||
editor.fx.0.y=165
|
||||
objectbench.height=92
|
||||
objectbench.width=666
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.8260105448154658
|
||||
package.editor.height=463
|
||||
package.editor.width=544
|
||||
package.editor.x=69
|
||||
package.editor.y=304
|
||||
package.frame.height=670
|
||||
package.frame.width=690
|
||||
package.numDependencies=9
|
||||
package.numTargets=7
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=100
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GLine
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=190
|
||||
target2.y=210
|
||||
target3.height=70
|
||||
target3.name=GeoObject
|
||||
target3.showInterface=false
|
||||
target3.type=AbstractTarget
|
||||
target3.width=120
|
||||
target3.x=190
|
||||
target3.y=100
|
||||
target4.height=70
|
||||
target4.name=GPoint
|
||||
target4.showInterface=false
|
||||
target4.type=ClassTarget
|
||||
target4.width=120
|
||||
target4.x=380
|
||||
target4.y=280
|
||||
target5.height=70
|
||||
target5.name=GCircle
|
||||
target5.showInterface=false
|
||||
target5.type=ClassTarget
|
||||
target5.width=120
|
||||
target5.x=100
|
||||
target5.y=350
|
||||
target6.height=70
|
||||
target6.name=GRectangle
|
||||
target6.showInterface=false
|
||||
target6.type=ClassTarget
|
||||
target6.width=120
|
||||
target6.x=240
|
||||
target6.y=350
|
||||
target7.height=70
|
||||
target7.name=GeoObjGUI
|
||||
target7.showInterface=false
|
||||
target7.type=ClassTarget
|
||||
target7.width=120
|
||||
target7.x=20
|
||||
target7.y=90
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_J/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_J/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
protected ArrayList<GeoObject> geoObjects = new ArrayList<GeoObject>();
|
||||
private ArrayList<GPoint> selectedPts = new ArrayList<GPoint>();
|
||||
private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
geoObjects.add(new GPoint(100, 100));
|
||||
geoObjects.add(new GPoint(140, 120));
|
||||
GPoint p3 = new GPoint(240, 120);
|
||||
geoObjects.add(p3);
|
||||
GPoint p4 = new GPoint(170, 130);
|
||||
geoObjects.add(p4);
|
||||
geoObjects.add(new GLine(p3, p4));
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
for (GeoObject go : geoObjects) {
|
||||
if (go instanceof GPoint) {
|
||||
GPoint p = (GPoint) go;
|
||||
double d = p.abstandZu(e.getX(), e.getY());
|
||||
if (d < 5) {
|
||||
dragPoint = p;
|
||||
} // end of if
|
||||
} // end of if
|
||||
} // end of for
|
||||
if (dragPoint == null) {
|
||||
GPoint newP = new GPoint(e.getX(), e.getY());
|
||||
geoObjects.add(newP);
|
||||
repaint();
|
||||
} else {
|
||||
if ((e.getModifiersEx() & e.SHIFT_DOWN_MASK) > 0) {
|
||||
if (dragPoint.getSelected()) {
|
||||
dragPoint.setSelected(false);
|
||||
selectedPts.remove(dragPoint);
|
||||
} else {
|
||||
dragPoint.setSelected(true);
|
||||
selectedPts.add(dragPoint);
|
||||
}// end of if
|
||||
repaint();
|
||||
} // end of if
|
||||
}// end of if
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (dragPoint != null) {
|
||||
if (Math.abs(dragPoint.getX()-e.getX())>0 || Math.abs(dragPoint.getY()-e.getY())>0) {
|
||||
dragPoint.setX(e.getX());
|
||||
dragPoint.setY(e.getY());
|
||||
repaint();
|
||||
} // end of if
|
||||
} // end of if
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public int getSelPtsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void clearSelectedPts() {
|
||||
for (GPoint p: selectedPts) {
|
||||
p.setSelected(false);
|
||||
} // end of for
|
||||
selectedPts.clear();
|
||||
}
|
||||
|
||||
public void addNewCircle() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GCircle circle = new GCircle(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(circle);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewRect() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GRectangle rectangle = new GRectangle(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(rectangle);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewLine() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GLine line = new GLine(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(line);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewPolygon() {
|
||||
if (selectedPts.size() >= 3) {
|
||||
GPolygon neck = new GPolygon(selectedPts);
|
||||
geoObjects.add(neck);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void setObjColor(Color newCol) { }
|
||||
|
||||
public void deleteObj() { }
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
for (GeoObject go : geoObjects ) {
|
||||
go.draw(g);
|
||||
} // end of for
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 04.10.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GCircle extends GLine {
|
||||
|
||||
// Anfang Attribute
|
||||
// Ende Attribute
|
||||
|
||||
public GCircle(GPoint point1, GPoint point2) {
|
||||
super(point1, point2);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
private int getRadius() {
|
||||
int dx = point2.getX() - point1.getX();
|
||||
int dy = point2.getY() - point1.getY();
|
||||
double r = Math.sqrt(dx * dx + dy * dy);
|
||||
return (int) Math.round(r);
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
int r = getRadius();
|
||||
int mx = point1.getX();
|
||||
int my = point1.getY();
|
||||
gr.drawOval(mx - r, my - r, 2*r, 2*r);
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GCircle
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 23.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class GLine extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
protected GPoint point1 = null;
|
||||
protected GPoint point2 = null;
|
||||
// Ende Attribute
|
||||
|
||||
public GLine(GPoint point1, GPoint point2) {
|
||||
super();
|
||||
this.point1 = point1;
|
||||
this.point2 = point2;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public void draw(Graphics gr) {
|
||||
gr.drawLine(point1.getX(),point1.getY(),point2.getX(), point2.getY());
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GLine
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 30.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x = 10;
|
||||
private int y = 15;
|
||||
private boolean selected;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public boolean getSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
if (selected) {
|
||||
gr.fillRect(x-2, y-2, 5, 5);
|
||||
} // end of if
|
||||
gr.drawRect(x-2, y-2, 5, 5);
|
||||
}
|
||||
|
||||
public double abstandZu(int mx, int my) {
|
||||
int dx = mx - x;
|
||||
int dy = my - y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 05.10.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPolygon extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private ArrayList<GLine> lines = new ArrayList<GLine>();
|
||||
// Ende Attribute
|
||||
|
||||
public GPolygon(ArrayList<GPoint> points) {;
|
||||
for (int i = 0; i < points.size()-1; i++) {
|
||||
GLine s = new GLine(points.get(i), points.get(i+1));
|
||||
lines.add(s);
|
||||
} // end of for
|
||||
GLine s = new GLine(points.get(points.size()-1), points.get(0));
|
||||
lines.add(s);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public void draw(Graphics gr) {
|
||||
for (GLine s : lines) {
|
||||
s.draw(gr);
|
||||
} // end of for
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GPolygon
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 04.10.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GRectangle extends GLine {
|
||||
|
||||
// Anfang Attribute
|
||||
// Ende Attribute
|
||||
|
||||
public GRectangle(GPoint point1, GPoint point2) {
|
||||
super(point1, point2);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public void draw(Graphics gr) {
|
||||
int lox = Math.min(point1.getX(), point2.getX());
|
||||
int loy = Math.min(point1.getY(), point2.getY());
|
||||
int dx = Math.abs(point2.getX() - point1.getX());
|
||||
int dy = Math.abs(point2.getY() - point1.getY());
|
||||
gr.drawRect(lox, loy, dx, dy);
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GRectangle
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
[Files]
|
||||
File0=GCircle.java
|
||||
File1=GeoObject.java
|
||||
File2=GLine.java
|
||||
File3=GPoint.java
|
||||
File4=GPolygon.java
|
||||
File5=GRectangle.java
|
||||
|
||||
[Box: - GCircle]
|
||||
X=136
|
||||
Y=677
|
||||
MinVis=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
FontSize=10
|
||||
FontName=MS Sans Serif
|
||||
|
||||
[Box: - GeoObject]
|
||||
X=382
|
||||
Y=250
|
||||
MinVis=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
FontSize=10
|
||||
FontName=MS Sans Serif
|
||||
|
||||
[Box: - GLine]
|
||||
X=337
|
||||
Y=466
|
||||
MinVis=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
FontSize=10
|
||||
FontName=MS Sans Serif
|
||||
|
||||
[Box: - GPoint]
|
||||
X=13
|
||||
Y=403
|
||||
MinVis=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
FontSize=10
|
||||
FontName=MS Sans Serif
|
||||
|
||||
[Box: - GPolygon]
|
||||
X=653
|
||||
Y=475
|
||||
MinVis=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
FontSize=10
|
||||
FontName=MS Sans Serif
|
||||
|
||||
[Box: - GRectangle]
|
||||
X=466
|
||||
Y=674
|
||||
MinVis=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
FontSize=10
|
||||
FontName=MS Sans Serif
|
||||
|
||||
[Diagram]
|
||||
OffsetX=190
|
||||
OffsetY=0
|
||||
Visibility=0
|
||||
ShowParameter=4
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
ShowConnections=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
ShowObjectDiagram=0
|
||||
|
||||
[Connections]
|
||||
V0=GCircle#GLine#Inheritends####0#0#0
|
||||
V1=GLine#GeoObject#Inheritends####0#0#0
|
||||
V2=GLine#GPoint#AssociationDirected#*##2#0#0#-1
|
||||
V3=GPoint#GeoObject#Inheritends####0#0#0
|
||||
V4=GPolygon#GeoObject#Inheritends####0#0#0
|
||||
V5=GPolygon#GLine#Aggregation#1##n#0#0#-1
|
||||
V6=GRectangle#GLine#Inheritends####0#0#0
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
I1=
|
||||
|
||||
[Window]
|
||||
Left=150
|
||||
Top=150
|
||||
Width=1125
|
||||
Height=417
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 669;
|
||||
int frameHeight = 454;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
object geoObjGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 2
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_E\GeoObGUI.jfm'
|
||||
ClientHeight = 426
|
||||
ClientWidth = 663
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 22.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private Color color;
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObject() {
|
||||
super();
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public abstract void draw(Graphics gr);
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GeoObject
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=GCircle
|
||||
dependency1.to=GPoint
|
||||
dependency1.type=UsesDependency
|
||||
dependency10.from=Board
|
||||
dependency10.to=GCircle
|
||||
dependency10.type=UsesDependency
|
||||
dependency11.from=Board
|
||||
dependency11.to=GRectangle
|
||||
dependency11.type=UsesDependency
|
||||
dependency12.from=Board
|
||||
dependency12.to=GPolygon
|
||||
dependency12.type=UsesDependency
|
||||
dependency2.from=GLine
|
||||
dependency2.to=GPoint
|
||||
dependency2.type=UsesDependency
|
||||
dependency3.from=GRectangle
|
||||
dependency3.to=GPoint
|
||||
dependency3.type=UsesDependency
|
||||
dependency4.from=GPolygon
|
||||
dependency4.to=GLine
|
||||
dependency4.type=UsesDependency
|
||||
dependency5.from=GPolygon
|
||||
dependency5.to=GPoint
|
||||
dependency5.type=UsesDependency
|
||||
dependency6.from=GeoObjGUI
|
||||
dependency6.to=Board
|
||||
dependency6.type=UsesDependency
|
||||
dependency7.from=Board
|
||||
dependency7.to=GeoObject
|
||||
dependency7.type=UsesDependency
|
||||
dependency8.from=Board
|
||||
dependency8.to=GPoint
|
||||
dependency8.type=UsesDependency
|
||||
dependency9.from=Board
|
||||
dependency9.to=GLine
|
||||
dependency9.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=800
|
||||
editor.fx.0.x=116
|
||||
editor.fx.0.y=133
|
||||
objectbench.height=93
|
||||
objectbench.width=780
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.84399375975039
|
||||
package.editor.height=534
|
||||
package.editor.width=658
|
||||
package.editor.x=58
|
||||
package.editor.y=234
|
||||
package.frame.height=742
|
||||
package.frame.width=804
|
||||
package.numDependencies=12
|
||||
package.numTargets=8
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=110
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GLine
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=200
|
||||
target2.y=280
|
||||
target3.height=70
|
||||
target3.name=GPolygon
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=500
|
||||
target3.y=280
|
||||
target4.height=70
|
||||
target4.name=GeoObject
|
||||
target4.showInterface=false
|
||||
target4.type=AbstractTarget
|
||||
target4.width=120
|
||||
target4.x=210
|
||||
target4.y=100
|
||||
target5.height=70
|
||||
target5.name=GPoint
|
||||
target5.showInterface=false
|
||||
target5.type=ClassTarget
|
||||
target5.width=120
|
||||
target5.x=350
|
||||
target5.y=280
|
||||
target6.height=70
|
||||
target6.name=GCircle
|
||||
target6.showInterface=false
|
||||
target6.type=ClassTarget
|
||||
target6.width=120
|
||||
target6.x=330
|
||||
target6.y=430
|
||||
target7.height=70
|
||||
target7.name=GRectangle
|
||||
target7.showInterface=false
|
||||
target7.type=ClassTarget
|
||||
target7.width=120
|
||||
target7.x=180
|
||||
target7.y=430
|
||||
target8.height=70
|
||||
target8.name=GeoObjGUI
|
||||
target8.showInterface=false
|
||||
target8.type=ClassTarget
|
||||
target8.width=120
|
||||
target8.x=20
|
||||
target8.y=90
|
||||
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_K/.gitignore
vendored
Normal file
6
Software/alg_oo_geoobjects/02_GeoObjects_Loes/GeomObj_K/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
*.sh
|
||||
*.class
|
||||
*.ctxt
|
||||
repo.adoc
|
||||
repo_subtree.adoc
|
||||
/alt
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
/**
|
||||
* Zeichenflueche fuer geometrische Objekte;
|
||||
* verwaltet sowohl die Objektliste als
|
||||
* auch die Liste der selektierten Objekte
|
||||
* sowie die Reaktionen auf Mausklicks und
|
||||
* -bewegungen im Zeichenbereich.
|
||||
*
|
||||
* @version 1.1 vom 21.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Board extends JPanel implements MouseListener, MouseMotionListener {
|
||||
// Anfang Attribute
|
||||
protected ArrayList<GeoObject> geoObjects = new ArrayList<GeoObject>();
|
||||
private ArrayList<GPoint> selectedPts = new ArrayList<GPoint>();
|
||||
private GPoint dragPoint = null;
|
||||
// Ende Attribute
|
||||
|
||||
// Konstruktor
|
||||
public Board() {
|
||||
super();
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
geoObjects.add(new GPoint(100, 100));
|
||||
geoObjects.add(new GPoint(140, 120));
|
||||
GPoint p3 = new GPoint(240, 120);
|
||||
geoObjects.add(p3);
|
||||
GPoint p4 = new GPoint(170, 130);
|
||||
geoObjects.add(p4);
|
||||
geoObjects.add(new GLine(p3, p4));
|
||||
}
|
||||
|
||||
// MouseListener
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
for (GeoObject go : geoObjects) {
|
||||
if (go instanceof GPoint) {
|
||||
GPoint p = (GPoint) go;
|
||||
double d = p.abstandZu(e.getX(), e.getY());
|
||||
if (d < 5) {
|
||||
dragPoint = p;
|
||||
} // end of if
|
||||
} // end of if
|
||||
} // end of for
|
||||
if (dragPoint == null) {
|
||||
GPoint newP = new GPoint(e.getX(), e.getY());
|
||||
geoObjects.add(newP);
|
||||
repaint();
|
||||
} else {
|
||||
if ((e.getModifiersEx() & e.SHIFT_DOWN_MASK) > 0) {
|
||||
if (dragPoint.getSelected()) {
|
||||
dragPoint.setSelected(false);
|
||||
selectedPts.remove(dragPoint);
|
||||
} else {
|
||||
dragPoint.setSelected(true);
|
||||
selectedPts.add(dragPoint);
|
||||
}// end of if
|
||||
repaint();
|
||||
} // end of if
|
||||
}// end of if
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
dragPoint = null;
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) { }
|
||||
|
||||
public void mouseExited(MouseEvent e) { }
|
||||
|
||||
public void mouseClicked(MouseEvent e) { }
|
||||
|
||||
// MouseMotionListener
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
if (dragPoint != null) {
|
||||
if (Math.abs(dragPoint.getX()-e.getX())>0 || Math.abs(dragPoint.getY()-e.getY())>0) {
|
||||
dragPoint.setX(e.getX());
|
||||
dragPoint.setY(e.getY());
|
||||
repaint();
|
||||
} // end of if
|
||||
} // end of if
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public int getSelPtsCount() {
|
||||
return selectedPts.size();
|
||||
}
|
||||
|
||||
private void clearSelectedPts() {
|
||||
for (GPoint p: selectedPts) {
|
||||
p.setSelected(false);
|
||||
} // end of for
|
||||
selectedPts.clear();
|
||||
}
|
||||
|
||||
public void addNewCircle() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GCircle circle = new GCircle(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(circle);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewRect() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GRectangle rectangle = new GRectangle(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(rectangle);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewLine() {
|
||||
if (selectedPts.size() == 2) {
|
||||
GLine line = new GLine(selectedPts.get(0), selectedPts.get(1));
|
||||
geoObjects.add(line);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addNewPolygon() {
|
||||
if (selectedPts.size() >= 3) {
|
||||
GPolygon neck = new GPolygon(selectedPts);
|
||||
geoObjects.add(neck);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void setObjColor(Color newCol) {
|
||||
for (GPoint p : selectedPts) {
|
||||
p.setColor(newCol);
|
||||
} // end of if
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void deleteObj() {
|
||||
if (selectedPts.size()>0) { // Wenn mindestens 1 Punkt zum Lueschen vorgemerkt ist...
|
||||
ArrayList<GeoObject> Objs2Delete = new ArrayList<GeoObject>();
|
||||
for (GPoint p : selectedPts) { // Alle zu lueschenden Punkte
|
||||
Objs2Delete.add(p); // ins Luesch-Array kopieren
|
||||
for (GeoObject o : geoObjects) { // Dann die davon abhuengigen Objekte
|
||||
if (o.dependsOn(p)) { // ebenfalls ins Luesch-Array
|
||||
Objs2Delete.add(o); // eintragen
|
||||
} // end of if
|
||||
} // end of for
|
||||
} // end of for
|
||||
|
||||
for (GeoObject o : Objs2Delete) { // Schlieuelich alle vorgemerkten
|
||||
geoObjects.remove(o); // Objekte lueschen.
|
||||
} // end of for
|
||||
clearSelectedPts();
|
||||
repaint();
|
||||
} // end of if
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
BasicStroke stroke2 = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
|
||||
BasicStroke.JOIN_MITER);
|
||||
((Graphics2D) g).setStroke(stroke2);
|
||||
for (GeoObject go : geoObjects ) {
|
||||
go.draw(g);
|
||||
} // end of for
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
|
||||
} // end of Board
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 04.10.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GCircle extends GLine {
|
||||
|
||||
// Anfang Attribute
|
||||
// Ende Attribute
|
||||
|
||||
public GCircle(GPoint point1, GPoint point2) {
|
||||
super(point1, point2);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
private int getRadius() {
|
||||
int dx = point2.getX() - point1.getX();
|
||||
int dy = point2.getY() - point1.getY();
|
||||
double r = Math.sqrt(dx * dx + dy * dy);
|
||||
return (int) Math.round(r);
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
int r = getRadius();
|
||||
int mx = point1.getX();
|
||||
int my = point1.getY();
|
||||
gr.setColor(getColor());
|
||||
gr.drawOval(mx - r, my - r, 2*r, 2*r);
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GCircle
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 23.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class GLine extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
protected GPoint point1 = null;
|
||||
protected GPoint point2 = null;
|
||||
// Ende Attribute
|
||||
|
||||
public GLine(GPoint point1, GPoint point2) {
|
||||
super();
|
||||
this.point1 = point1;
|
||||
this.point2 = point2;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public boolean dependsOn(GeoObject p) {
|
||||
boolean res = (p == point1) || (p == point2);
|
||||
return res;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(getColor());
|
||||
gr.drawLine(point1.getX(),point1.getY(),point2.getX(), point2.getY());
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GLine
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 30.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPoint extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private int x = 10;
|
||||
private int y = 15;
|
||||
private boolean selected;
|
||||
// Ende Attribute
|
||||
|
||||
public GPoint(int x, int y) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public boolean getSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(this.getColor());
|
||||
if (selected) {
|
||||
gr.fillRect(x-2, y-2, 5, 5);
|
||||
} // end of if
|
||||
gr.drawRect(x-2, y-2, 5, 5);
|
||||
}
|
||||
|
||||
public double abstandZu(int mx, int my) {
|
||||
int dx = mx - x;
|
||||
int dy = my - y;
|
||||
double d = Math.sqrt(dx * dx + dy * dy);
|
||||
return d;
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of Point
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 05.10.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GPolygon extends GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private ArrayList<GLine> lines = new ArrayList<GLine>();
|
||||
// Ende Attribute
|
||||
|
||||
public GPolygon(ArrayList<GPoint> points) {;
|
||||
for (int i = 0; i < points.size()-1; i++) {
|
||||
GLine s = new GLine(points.get(i), points.get(i+1));
|
||||
lines.add(s);
|
||||
} // end of for
|
||||
GLine s = new GLine(points.get(points.size()-1), points.get(0));
|
||||
lines.add(s);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public boolean dependsOn(GeoObject p) {
|
||||
boolean res = false;
|
||||
for (GLine b : lines) {
|
||||
if (b.dependsOn(p)) {
|
||||
res = true;
|
||||
} // end of if
|
||||
} // end of for
|
||||
return res;
|
||||
}
|
||||
|
||||
public void draw(Graphics gr) {
|
||||
gr.setColor(getColor());
|
||||
for (GLine s : lines) {
|
||||
s.draw(gr);
|
||||
} // end of for
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GPolygon
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 04.10.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class GRectangle extends GLine {
|
||||
|
||||
// Anfang Attribute
|
||||
// Ende Attribute
|
||||
|
||||
public GRectangle(GPoint point1, GPoint point2) {
|
||||
super(point1, point2);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public void draw(Graphics gr) {
|
||||
int lox = Math.min(point1.getX(), point2.getX());
|
||||
int loy = Math.min(point1.getY(), point2.getY());
|
||||
int dx = Math.abs(point2.getX() - point1.getX());
|
||||
int dy = Math.abs(point2.getY() - point1.getY());
|
||||
gr.setColor(getColor());
|
||||
gr.drawRect(lox, loy, dx, dy);
|
||||
}
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GRectangle
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
[Files]
|
||||
File0=Board.java
|
||||
File1=GCircle.java
|
||||
File2=GeoObject.java
|
||||
File3=GeoObjGUI.java
|
||||
File4=GLine.java
|
||||
File5=GPoint.java
|
||||
File6=GPolygon.java
|
||||
File7=GRectangle.java
|
||||
|
||||
[Box: - Board]
|
||||
X=431
|
||||
Y=143
|
||||
MinVis=0
|
||||
|
||||
[Box: - GCircle]
|
||||
X=151
|
||||
Y=723
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObject]
|
||||
X=150
|
||||
Y=328
|
||||
MinVis=0
|
||||
|
||||
[Box: - GeoObjGUI]
|
||||
X=16
|
||||
Y=14
|
||||
MinVis=0
|
||||
|
||||
[Box: - GLine]
|
||||
X=287
|
||||
Y=549
|
||||
MinVis=0
|
||||
|
||||
[Box: - GPoint]
|
||||
X=26
|
||||
Y=492
|
||||
MinVis=0
|
||||
|
||||
[Box: - GPolygon]
|
||||
X=591
|
||||
Y=558
|
||||
MinVis=0
|
||||
|
||||
[Box: - GRectangle]
|
||||
X=421
|
||||
Y=723
|
||||
MinVis=0
|
||||
|
||||
[Diagram]
|
||||
OffsetX=32
|
||||
OffsetY=0
|
||||
ShowAssoc=1
|
||||
Visibility=0
|
||||
ShowParameter=2
|
||||
SortOrder=0
|
||||
ShowIcons=0
|
||||
Fontname=MS Sans Serif
|
||||
Fontsize=10
|
||||
|
||||
[Connections]
|
||||
V0=Board#GeoObject#AssociationDirected####0#0#
|
||||
V1=GeoObjGUI#Board#AssociationDirected####0#0#
|
||||
V2=GLine#GPoint#AssociationDirected####0#0#
|
||||
V3=Board#GPoint#AssociationDirected####0#0#
|
||||
V4=GPolygon#GLine#Aggregation####0#0#
|
||||
V5=GCircle#GLine#Inheritends####0#0#
|
||||
V6=GLine#GeoObject#Inheritends####0#0#
|
||||
V7=GPoint#GeoObject#Inheritends####0#0#
|
||||
V8=GPolygon#GeoObject#Inheritends####0#0#
|
||||
V9=GRectangle#GLine#Inheritends####0#0#
|
||||
|
||||
[Interactive]
|
||||
I0=
|
||||
I1=
|
||||
|
||||
[Window]
|
||||
Left=150
|
||||
Top=150
|
||||
Width=1129
|
||||
Height=421
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Grafische Benutzeroberflueche
|
||||
* fuer geometrische Objekte;
|
||||
* verwaltet das Anwendungsfenster
|
||||
* und Mausklicks auf die Buttons.
|
||||
*
|
||||
* @version 1.1 vom 20.07.2012
|
||||
* @author Tom Schaller, Roland Mechling
|
||||
*/
|
||||
|
||||
public class GeoObjGUI extends JFrame {
|
||||
// Anfang Attribute
|
||||
private Board board1 = new Board();
|
||||
private JButton jBCircle = new JButton();
|
||||
private JButton jBRect = new JButton();
|
||||
private JButton jBLine = new JButton();
|
||||
private JButton jBPolygone = new JButton();
|
||||
private JButton jBDelete = new JButton();
|
||||
private JButton jBColour = new JButton();
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObjGUI(String title) {
|
||||
// Frame-Initialisierung
|
||||
super(title);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
int frameWidth = 669;
|
||||
int frameHeight = 454;
|
||||
setSize(frameWidth, frameHeight);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
int x = (d.width - getSize().width) / 2;
|
||||
int y = (d.height - getSize().height) / 2;
|
||||
setLocation(x, y);
|
||||
setResizable(false);
|
||||
Container cp = getContentPane();
|
||||
cp.setLayout(null);
|
||||
// Anfang Komponenten
|
||||
|
||||
board1.setBounds(0, 0, 537, 425);
|
||||
board1.setBackground(Color.WHITE);
|
||||
cp.add(board1);
|
||||
jBCircle.setBounds(552, 64, 99, 25);
|
||||
jBCircle.setText("Kreis");
|
||||
jBCircle.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBCircle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBCircle_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBCircle);
|
||||
jBRect.setBounds(552, 104, 99, 25);
|
||||
jBRect.setText("Rechteck");
|
||||
jBRect.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBRect.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBRect_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBRect);
|
||||
jBLine.setBounds(552, 24, 99, 25);
|
||||
jBLine.setText("Strecke");
|
||||
jBLine.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBLine.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBLine_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBLine);
|
||||
jBPolygone.setBounds(552, 144, 99, 25);
|
||||
jBPolygone.setText("Polygon");
|
||||
jBPolygone.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBPolygone.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBPolygone_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBPolygone);
|
||||
jBDelete.setBounds(553, 293, 96, 34);
|
||||
jBDelete.setText("Objekt lueschen");
|
||||
jBDelete.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBDelete.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBDelete_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jBDelete.setFont(new Font("Dialog", Font.BOLD, 12));
|
||||
cp.add(jBDelete);
|
||||
jBColour.setBounds(552, 248, 97, 33);
|
||||
jBColour.setText("Objekt fuerben");
|
||||
jBColour.setMargin(new Insets(2, 2, 2, 2));
|
||||
jBColour.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jBColour_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jBColour);
|
||||
setTitle("Geometrische Objekte");
|
||||
// Ende Komponenten
|
||||
|
||||
setVisible(true);
|
||||
} // end of public GeoObjGUI
|
||||
|
||||
// Anfang Methoden
|
||||
|
||||
public void jBCircle_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewCircle();
|
||||
} // end of jBCircle_ActionPerformed
|
||||
|
||||
public void jBRect_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewRect();
|
||||
} // end of jBRect_ActionPerformed
|
||||
|
||||
public void jBLine_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewLine();
|
||||
} // end of jBLine_ActionPerformed
|
||||
|
||||
public void jBPolygone_ActionPerformed(ActionEvent evt) {
|
||||
board1.addNewPolygon();
|
||||
} // end of jBPolygone_ActionPerformed
|
||||
|
||||
public void jBDelete_ActionPerformed(ActionEvent evt) {
|
||||
board1.deleteObj();
|
||||
} // end of jBDelete_ActionPerformed
|
||||
|
||||
public void jBColour_ActionPerformed(ActionEvent evt) {
|
||||
if (board1.getSelPtsCount() > 0) {
|
||||
Color newCol = JColorChooser.showDialog(this, "Wuehle Farbe", Color.BLACK);
|
||||
board1.setObjColor(newCol);
|
||||
} // end of if
|
||||
} // end of jBColour_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
public static void main(String[] args) {
|
||||
new GeoObjGUI("GeoObjGUI");
|
||||
} // end of main
|
||||
|
||||
} // end of class DrawItGUI
|
||||
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
object geoObjGUI: TFGUIFormular
|
||||
Left = 0
|
||||
Top = 2
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption =
|
||||
'D:\Dokumente\Schule\Unsere_FoBi\Reihe_B2_rev\Roland\GeomObj\Java' +
|
||||
'-Variante_T3\GeomObj_E\GeoObGUI.jfm'
|
||||
ClientHeight = 426
|
||||
ClientWidth = 663
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -10
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
FormStyle = fsMDIChild
|
||||
OldCreateOrder = True
|
||||
Position = poDesigned
|
||||
Visible = True
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnResize = FormResize
|
||||
FrameType = 5
|
||||
Resizable = False
|
||||
Undecorated = False
|
||||
Background = clBtnFace
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object jBCircle: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 64
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBCircle_ActionPerformed'
|
||||
Text = 'Kreis'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBRect: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 104
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBRect_ActionPerformed'
|
||||
Text = 'Rechteck'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBLine: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 24
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBLine_ActionPerformed'
|
||||
Text = 'Strecke'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBPolygone: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 144
|
||||
Width = 99
|
||||
Height = 25
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBPolygone_ActionPerformed'
|
||||
Text = 'Polygon'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object board1: TJPanel
|
||||
Tag = 38
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 537
|
||||
Height = 425
|
||||
HelpKeyword = 'Board'
|
||||
Foreground = 3355443
|
||||
Background = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBDelete: TJButton
|
||||
Tag = 4
|
||||
Left = 553
|
||||
Top = 293
|
||||
Width = 96
|
||||
Height = 34
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBDelete_ActionPerformed'
|
||||
Text = 'Objekt l'#246'schen'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
object jBColour: TJButton
|
||||
Tag = 4
|
||||
Left = 552
|
||||
Top = 248
|
||||
Width = 97
|
||||
Height = 33
|
||||
Foreground = 3355443
|
||||
Background = 15658734
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Dialog'
|
||||
Font.Style = [fsBold]
|
||||
actionPerformed = 'jBColour_ActionPerformed'
|
||||
Text = 'Objekt f'#228'rben'
|
||||
Mnemonic = 0
|
||||
DisplayedMnemonicIndex = 0
|
||||
Selected = False
|
||||
BorderPainted = True
|
||||
FocusPainted = False
|
||||
ContentAreaFilled = True
|
||||
HorizontalAlignment = CENTER
|
||||
VerticalAlignment = CENTER
|
||||
HorizontalTextPosition = RIGHT
|
||||
VerticalTextPosition = CENTER
|
||||
IconTextGap = 4
|
||||
RolloverEnabled = False
|
||||
Border.BorderType = NoBorder
|
||||
Border.LineColor = clBlack
|
||||
Border.LineThickness = 0
|
||||
Border.LineRounded = False
|
||||
Border.EtchHighlightColor = clBlack
|
||||
Border.EtchShadowColor = clBlack
|
||||
Border.Etchtype = 0
|
||||
Border.BevelHighlightColor = clBlack
|
||||
Border.BevelShadowColor = clBlack
|
||||
Border.Beveltype = 0
|
||||
Border.MatteColor = clBlack
|
||||
Border.MatteTop = 0
|
||||
Border.MatteLeft = 0
|
||||
Border.MatteBottom = 0
|
||||
Border.MatteRight = 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
*
|
||||
* Beschreibung
|
||||
*
|
||||
* @version 1.0 vom 22.09.2012
|
||||
* @author
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class GeoObject {
|
||||
|
||||
// Anfang Attribute
|
||||
private Color color;
|
||||
// Ende Attribute
|
||||
|
||||
public GeoObject() {
|
||||
super();
|
||||
this.color = new Color(0, 0, 0);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public boolean dependsOn(GeoObject p) {
|
||||
return false;
|
||||
};
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public abstract void draw(Graphics gr);
|
||||
|
||||
// Ende Methoden
|
||||
} // end of GeoObject
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=GCircle
|
||||
dependency1.to=GPoint
|
||||
dependency1.type=UsesDependency
|
||||
dependency10.from=Board
|
||||
dependency10.to=GCircle
|
||||
dependency10.type=UsesDependency
|
||||
dependency11.from=Board
|
||||
dependency11.to=GRectangle
|
||||
dependency11.type=UsesDependency
|
||||
dependency12.from=Board
|
||||
dependency12.to=GPolygon
|
||||
dependency12.type=UsesDependency
|
||||
dependency2.from=GLine
|
||||
dependency2.to=GPoint
|
||||
dependency2.type=UsesDependency
|
||||
dependency3.from=GRectangle
|
||||
dependency3.to=GPoint
|
||||
dependency3.type=UsesDependency
|
||||
dependency4.from=GPolygon
|
||||
dependency4.to=GLine
|
||||
dependency4.type=UsesDependency
|
||||
dependency5.from=GPolygon
|
||||
dependency5.to=GPoint
|
||||
dependency5.type=UsesDependency
|
||||
dependency6.from=GeoObjGUI
|
||||
dependency6.to=Board
|
||||
dependency6.type=UsesDependency
|
||||
dependency7.from=Board
|
||||
dependency7.to=GeoObject
|
||||
dependency7.type=UsesDependency
|
||||
dependency8.from=Board
|
||||
dependency8.to=GPoint
|
||||
dependency8.type=UsesDependency
|
||||
dependency9.from=Board
|
||||
dependency9.to=GLine
|
||||
dependency9.type=UsesDependency
|
||||
editor.fx.0.height=0
|
||||
editor.fx.0.width=0
|
||||
editor.fx.0.x=0
|
||||
editor.fx.0.y=0
|
||||
objectbench.height=93
|
||||
objectbench.width=736
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.8333333333333334
|
||||
package.editor.height=493
|
||||
package.editor.width=614
|
||||
package.editor.x=64
|
||||
package.editor.y=270
|
||||
package.frame.height=701
|
||||
package.frame.width=760
|
||||
package.numDependencies=12
|
||||
package.numTargets=8
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=49
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Board
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=90
|
||||
target1.y=10
|
||||
target2.height=70
|
||||
target2.name=GLine
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=180
|
||||
target2.y=260
|
||||
target3.height=70
|
||||
target3.name=GPolygon
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=460
|
||||
target3.y=260
|
||||
target4.height=70
|
||||
target4.name=GeoObject
|
||||
target4.showInterface=false
|
||||
target4.type=AbstractTarget
|
||||
target4.width=120
|
||||
target4.x=190
|
||||
target4.y=90
|
||||
target5.height=70
|
||||
target5.name=GPoint
|
||||
target5.showInterface=false
|
||||
target5.type=ClassTarget
|
||||
target5.width=120
|
||||
target5.x=320
|
||||
target5.y=260
|
||||
target6.height=70
|
||||
target6.name=GCircle
|
||||
target6.showInterface=false
|
||||
target6.type=ClassTarget
|
||||
target6.width=120
|
||||
target6.x=180
|
||||
target6.y=390
|
||||
target7.height=70
|
||||
target7.name=GRectangle
|
||||
target7.showInterface=false
|
||||
target7.type=ClassTarget
|
||||
target7.width=120
|
||||
target7.x=320
|
||||
target7.y=390
|
||||
target8.height=70
|
||||
target8.name=GeoObjGUI
|
||||
target8.showInterface=false
|
||||
target8.type=ClassTarget
|
||||
target8.width=120
|
||||
target8.x=10
|
||||
target8.y=90
|
||||
11
Software/alg_oo_geoobjects/readme.adoc
Normal file
11
Software/alg_oo_geoobjects/readme.adoc
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
= Material :
|
||||
|
||||
|===
|
||||
|Zuordnung|
|
||||
|Klassenstufe|
|
||||
|Bildungsplanbezug |
|
||||
|Werkzeug|
|
||||
|Autoren|
|
||||
|===
|
||||
|
||||
== Inhalt
|
||||
Loading…
Add table
Add a link
Reference in a new issue