WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   Bin zu blöd für Java (http://www.wcm.at/forum/showthread.php?t=203563)

FritziNoob 13.11.2006 23:21

Bin zu blöd für Java
 
Kann mir irgendwer bei dem Problem helfen und das zum Laufen zu bringen ich habe beim "main" noch ein paar Probleme.


import javax.swing.*;
import javax.swing.text.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;

// WildTypeDNAPanel
public class WildTypeDNAPanel extends NextPanel {
JTextArea textArea;

public WildTypeDNAPanel(NextPanelListener n) {
super(n);

textArea = new JTextArea();
textArea.setLineWrap(true);
textArea.setText("");//"CTCGAGCGACCGAATTGACCGAACGGTCATGGCTTCCCTTGGCTAGTGC AGTGGCCCAAGTGCTTACTACTAGGTGGGAACCCAGTCTGGCACTTACGC ACGTGTACAGAA");

// Add it all to the panel
thePanel.setLayout(new BorderLayout());
thePanel.add(new JLabel("Please enter your wild-type DNA sequence below"/*, starting in-frame"*/), BorderLayout.NORTH);
thePanel.add(textArea, BorderLayout.CENTER);
textArea.setBorder(BorderFactory.createLineBorder( Color.BLACK, 1));
}

public void actionPerformed(ActionEvent a) {
String command = a.getActionCommand();

if(command.equals(backString))
listener.backClicked();
else if(command.equals(nextString)) {
String dnaSeq = getDNASequence();
if(dnaSeq == null)
new NotificationPopup("Invalid DNA Sequence - can only contain " +
"'A', 'C', 'G', or 'T'");
/*else if(dnaSeq.length() % 3 != 0)
new NotificationPopup("Invalid DNA Sequence - must contain only " +
"complete codons (multiples of three)");*/
else
listener.nextClicked(dnaSeq, null, true);
}
}

String getDNASequence() {
String text = textArea.getText().toUpperCase().trim();
StringBuffer formattedSequence = new StringBuffer("");

for(int i = 0; i < text.length(); i++) {
char ch = text.charAt(i);
if(Character.isWhitespace(ch) == false) {
if(ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T')
formattedSequence.append(ch);
else
return null;
}
}

return formattedSequence.toString();
}

// Don't need to do anything after the Welcome window's next button is clicked
public void hasFocus(String results1, String results2, boolean defaultOutputFormat) {
}
}

hewlett 14.11.2006 16:21

mach dir deine Hausübung selbst!

Manche Leute werden immer dreister!

:mad2:

deleted_150216 15.11.2006 07:57

hmm, ich glaub ich weiss wo das problem mit dem main is - du hast keines :D


Alle Zeitangaben in WEZ +2. Es ist jetzt 00:28 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag