/**
* Erstellt am: 25.08.2009 / 09:44:26
* Author: Ole
*/
package Plotter;
/**
*
* @author Ole
*
*/
public class Plotter extends JFrame
{
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private BufferedImage img = null;
private ImagePanel ip;
private Container c;
/**
*
* Erstellt am: 25.08.2009 / 09:48:55
* Author: Ole
* @param maxY
* @param maxX
* @param bpcount
*
*/
public Plotter(common.Base[] _Array, int _bpcount, int _maxX, int _maxY)
{
super();
array = _Array;
bpcount = _bpcount;
maxX = _maxX;
maxY = _maxY;
initialize();
}
/**
*
* Erstellt am: 25.08.2009 / 09:48:50
* Author: Ole
*
*/
private void initialize() {
this.setTitle("RNAPlotter - Strukturdarstellung");
this.setContentPane(getJContentPane());
this.setMinimumSize(new Dimension(500, 500));
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
this.setJMenuBar(getJJMenuBar());
zeichneStrukturImage(); // Initialisiert img und zeichnet den Inhalt darauf
c = getJContentPane();
c.setLayout(new BorderLayout(5,5));
ip = new ImagePanel();
c.add(new JScrollPane(ip), BorderLayout.CENTER);
try
{
ip.setImage(img);
}
catch (Exception x) {}
pack();
this.setVisible(true);
}
/**
*
* Erstellt am: 25.08.2009 / 09:48:30
* Author: Ole
*
* @return
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel()
{
private static final long serialVersionUID = 1L;
public void paintComponent(Graphics g)
{
super.paintComponent(g);
}
};
}
return jContentPane;
}
}
public class ImagePanel extends JPanel {
private BufferedImage image;
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (image == null) return;
g.drawImage(image, 0, 0, image.getWidth() ,
image.getHeight(), null);
}
public void setImage(BufferedImage image) {
this.image = image;
}
}