I have a little problem at the moment what I am trying to do is plot a graph from two sequences and plot it onto the jPanel but I can't. I have the gui done and the link to a certain file but can't make sense out of it if somebody knows how to do this please help.
.
.
.
.
.
An the inputs are going to be letters in stead of numbers so every time the program encounters the same letter on both axis it will put a line like the photo shows.
/****************************************************************/
/* DotPlot */
/* */
/****************************************************************/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* Summary description for DotPlot
*
*/
public class DotPlot extends JFrame
{
// Variables declaration
private JLabel jLabel1;
private JLabel jLabel2;
private JLabel jLabel3;
private JTextArea jTextArea1;
private JScrollPane jScrollPane1;
private JTextArea jTextArea2;
private JScrollPane jScrollPane2;
private JButton jButton1;
private JPanel contentPane;
//-----
private JPanel jPanel1;
//-----
// End of variables declaration
public DotPlot()
{
super();
initializeComponent();
//
// Add any constructor code after initializeComponent call
//
this.setVisible(true);
}
/**
* This method is called from within the constructor to initialize the form.
*/
private void initializeComponent()
{
jLabel1 = new JLabel();
jLabel2 = new JLabel();
jLabel3 = new JLabel();
jTextArea1 = new JTextArea();
jScrollPane1 = new JScrollPane();
jTextArea2 = new JTextArea();
jScrollPane2 = new JScrollPane();
jButton1 = new JButton();
contentPane = (JPanel)this.getContentPane();
//-----
jPanel1 = new JPanel();
//-----
//
// jLabel1
//
jLabel1.setBackground(new Color(105, 188, 246));
jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
jLabel1.setHorizontalTextPosition(SwingConstants.CENTER);
jLabel1.setOpaque(true);
jLabel1.setText("FASTA Sequences File 1 ");
//
// jLabel2
//
jLabel2.setBackground(new Color(105, 188, 246));
jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
jLabel2.setHorizontalTextPosition(SwingConstants.CENTER);
jLabel2.setOpaque(true);
jLabel2.setText("FASTA Sequences File 2 ");
//
// jLabel3
//
jLabel3.setBackground(new Color(105, 188, 246));
jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
jLabel3.setOpaque(true);
jLabel3.setText("Dot-Plot Graph");
//
// jTextArea1
//
jTextArea1.setWrapStyleWord(true);
//
// jScrollPane1
//
jScrollPane1.setViewportView(jTextArea1);
//
// jTextArea2
//
jTextArea2.setLineWrap(true);
//
// jScrollPane2
//
jScrollPane2.setViewportView(jTextArea2);
//
// jButton1
//
jButton1.setText("Plot the Sequance");
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jButton1_actionPerformed(e);
}
});
//
// contentPane
//
contentPane.setLayout(null);
addComponent(contentPane, jLabel1, 19,10,249,18);
addComponent(contentPane, jLabel2, 18,229,249,18);
addComponent(contentPane, jLabel3, 284,11,500,18);
addComponent(contentPane, jScrollPane1, 18,29,250,160);
addComponent(contentPane, jScrollPane2, 18,247,250,160);
addComponent(contentPane, jButton1, 658,422,127,28);
addComponent(contentPane, jPanel1, 284,30,500,379);
//
// jPanel1
//
jPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
jPanel1.setBorder(BorderFactory.createLineBorder(Color.blue));
//
// DotPlot
//
this.setTitle("DotPlot");
this.setLocation(new Point(0, 0));
this.setSize(new Dimension(800, 486));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
private void addComponent(Container container,Component c,int x,int y,int width,int height)
{
c.setBounds(x,y,width,height);
container.add(c);
}
//
// Add any appropriate code in the following Event Handling Methods
//
private void jButton1_actionPerformed(ActionEvent e)
{
System.out.println("\njButton1_actionPerformed(ActionEvent e) called.");
// Add any handling code here
}
//
// Add any method code to meet your needs in the following area
//
public static void main(String[] args)
{
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch (Exception ex)
{
System.out.println("Failed loading L&F: ");
System.out.println(ex);
}
new DotPlot();
}
}