ActionControl Anpassungen

This commit is contained in:
Ivan
2014-11-07 21:21:08 +01:00
parent 2c0d409463
commit 99250750fa
@@ -8,41 +8,41 @@ import javax.swing.*;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
public class ActionControl { public class ActionControl {
private Smashing smashing; private static Smashing smashing;
private Keysequence keysequence; private static Keysequence keysequence;
private JPanel panel; private static JPanel panel;
private JLabel comp; private static JLabel comp;
public void setPanel(JPanel newPanel){ public static void setPanel(JPanel newPanel){
panel = newPanel; panel = newPanel;
smashing = new Smashing();
keysequence = new Keysequence();
comp = new JLabel();
panel.add(comp);
} }
public void setAction(String s){ public static void setAction(String s){
System.out.println("prompt");
if(s.equals("smashing")){ if(s.equals("smashing")){
smashing = new Smashing(); String str= "Bitte die Taste "+smashing.getKey()+" so schnell wie möglich drücken";
String tmp= "Bitte die Taste "+smashing.getKey()+" so schnell wie möglich drücken"; comp.setText(str);
comp = new JLabel(tmp);
comp.setFont(new Font("Arial", Font.CENTER_BASELINE, 16)); comp.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
comp.setBorder(new LineBorder(Color.BLACK, 1)); comp.setBorder(new LineBorder(Color.BLACK, 1));
comp.setSize(100,10); comp.setSize(100,10);
panel.add(comp);
panel.setVisible(false); panel.setVisible(false);
panel.setVisible(true); panel.setVisible(true);
}else{ }else{
keysequence = new Keysequence(); char []tmp = keysequence.getKeySequence();
String tmp="Bitte diese Tastenkombination "+keysequence.getKeySequence()[0]+" "+keysequence.getKeySequence()[1]+" "+keysequence.getKeySequence()[2]+" "+keysequence.getKeySequence()[3]+" "+" so schnell wie möglich drücken"; String str="Bitte diese Tastenkombination \""+tmp[0]+" "+tmp[1]+" "+tmp[2]+" "+tmp[3]+"\" "+"so schnell wie möglich eingeben";
comp = new JLabel(tmp); comp.setText(str);
comp.setFont(new Font("Arial", Font.CENTER_BASELINE, 16)); comp.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
comp.setBorder(new LineBorder(Color.BLACK, 1)); comp.setBorder(new LineBorder(Color.BLACK, 1));
comp.setSize(100,10); comp.setSize(100,10);
panel.add(comp);
panel.setVisible(false); panel.setVisible(false);
panel.setVisible(true); panel.setVisible(true);
} }
} }
public void wishPanel(){ public static void wishPanel(){
comp.setVisible(false); comp.setText("");
} }
} }