1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| package test;
import java.awt.*;
import javax.swing.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class MapPane extends JPanel {
/** Creates a new instance.
*/
public MapPane() {
super();
}
/** {@inheritDoc}
*/
@Override protected void paintComponent(Graphics comp) {
Graphics2D comp2D = (Graphics2D) comp;
comp2D.drawLine(1, 400, 600, 400);
}
/** Program entry point.
* @param args Arguments from the command line.
*/
public static void main(String ...args) {
SwingUtilities.invokeLater(new Runnable() {
/** {@inheritDoc}
*/
public void run() {
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.add(new MapPane(), BorderLayout.CENTER);
frame.setSize(1000, 800);
frame.setVisible(true);
}
});
}
} |
Partager