habe ein applet geschrieben, in dem auch ein paar imageicons sind.
leider werden mir nur die bilder angezeigt, aber nicht die textboxen.
weiß leider nicht mehr, was ich noch machen soll, damit alles angezeigt wird.
bekomme die textfelder nur zu sehen, wenn ich darauf klicke...
und gibt es die möglichkeit die textfelder alle gleich zu formatieren, dass ich das nicht für jeden einzeln mache, wie bisher?
leider werden mir nur die bilder angezeigt, aber nicht die textboxen.
weiß leider nicht mehr, was ich noch machen soll, damit alles angezeigt wird.
bekomme die textfelder nur zu sehen, wenn ich darauf klicke...
Code:
import java.applet.*;
import java.awt.*;
import javax.swing.*;
public class Hintergrund extends JApplet
{
//Farben definieren
Color dunkelblauCOLOR= new Color(16, 0, 127);
Color mittelblauCOLOR= new Color(205, 217, 239);
Color hellblauCOLOR= new Color(240, 244, 247);
Color grauCOLOR= new Color(230, 230, 230);
Color backCOLOR= new Color(255, 255, 255);
//Variablem für Anzeige definieren
String tempAktVar,preAktVar,windAktVar,airAktVar,lightAktVar;
String tempProgVar,preProgVar,windProgVar,airProgVar,lightProgVar;
//Grafiken laden
Icon prognosis = new ImageIcon("prognosisButton.jpg");
ImageIcon header = new ImageIcon("BACKGROUND_TOP_LAYER.jpg");
ImageIcon windrose = new ImageIcon("Nord.gif");
//Button definieren
JButton prognosisButton = new JButton(prognosis);
//Textfelder anlegen
JTextField tempAkt;
JTextField preAkt;
JTextField windAkt;
JTextField airAkt;
JTextField lightAkt;
JTextField tempProg;
JTextField preProg;
JTextField windProg;
JTextField airProg;
JTextField lightProg;
public void paint(Graphics g){
//Eingebundene Grafiken
header.paintIcon(this,g,0,0);
windrose.paintIcon(this,g,277,426);
windrose.paintIcon(this,g,682,426);
}
public void init(){
tempAktVar = tempAktVar + " °C";
preAktVar = preAktVar + " ml/m²";
windAktVar = windAktVar + " km/h";
airAktVar = airAktVar + " %";
lightAktVar = lightAktVar + " LUX";
tempProgVar = tempProgVar + " °C";
preProgVar = preProgVar + " ml/m²";
windProgVar = windProgVar + " km/h";
airProgVar = airProgVar + " %";
lightProgVar = lightProgVar + " LUX";
Container hintergrundContainer = getContentPane();
hintergrundContainer.setBackground(backCOLOR);
hintergrundContainer.setLayout(null);
prognosisButton.setBorderPainted(false);
prognosisButton.setBounds(600,534,184,50);
tempAkt = new JTextField(tempAktVar);
tempAkt.setEditable(false);
tempAkt.setBackground(backCOLOR);
tempAkt.setForeground(dunkelblauCOLOR);
tempAkt.setHorizontalAlignment(JTextField.RIGHT);
tempAkt.setFont(new Font("Arial",Font.BOLD, 14));
tempAkt.setBorder(null);
tempAkt.setBounds(120,338,68,26);
preAkt = new JTextField(preAktVar);
preAkt.setEditable(false);
preAkt.setBackground(backCOLOR);
preAkt.setForeground(dunkelblauCOLOR);
preAkt.setHorizontalAlignment(JTextField.RIGHT);
preAkt.setFont(new Font("Arial",Font.BOLD, 14));
preAkt.setBorder(null);
preAkt.setBounds(120,392,68,26);
windAkt = new JTextField(windAktVar);
windAkt.setEditable(false);
windAkt.setBackground(backCOLOR);
windAkt.setForeground(dunkelblauCOLOR);
windAkt.setHorizontalAlignment(JTextField.RIGHT);
windAkt.setFont(new Font("Arial",Font.BOLD, 14));
windAkt.setBorder(null);
windAkt.setBounds(120,447,68,26);
airAkt = new JTextField(airAktVar);
airAkt.setEditable(false);
airAkt.setBackground(backCOLOR);
airAkt.setForeground(dunkelblauCOLOR);
airAkt.setHorizontalAlignment(JTextField.RIGHT);
airAkt.setFont(new Font("Arial",Font.BOLD, 14));
airAkt.setBorder(null);
airAkt.setBounds(293,338,68,26);
lightAkt = new JTextField(lightAktVar);
lightAkt.setEditable(false);
lightAkt.setBackground(backCOLOR);
lightAkt.setForeground(dunkelblauCOLOR);
lightAkt.setHorizontalAlignment(JTextField.RIGHT);
lightAkt.setFont(new Font("Arial",Font.BOLD, 14));
lightAkt.setBorder(null);
lightAkt.setBounds(293,392,68,26);
tempProg = new JTextField(tempProgVar);
tempProg.setEditable(false);
tempProg.setBackground(backCOLOR);
tempProg.setForeground(dunkelblauCOLOR);
tempProg.setHorizontalAlignment(JTextField.RIGHT);
tempProg.setFont(new Font("Arial",Font.BOLD, 14));
tempProg.setBorder(null);
tempProg.setBounds(525,338,68,26);
preProg = new JTextField(preProgVar);
preProg.setEditable(false);
preProg.setBackground(backCOLOR);
preProg.setForeground(dunkelblauCOLOR);
preProg.setHorizontalAlignment(JTextField.RIGHT);
preProg.setFont(new Font("Arial",Font.BOLD, 14));
preProg.setBorder(null);
preProg.setBounds(525,392,68,26);
windProg = new JTextField(windProgVar);
windProg.setEditable(false);
windProg.setBackground(backCOLOR);
windProg.setForeground(dunkelblauCOLOR);
windProg.setHorizontalAlignment(JTextField.RIGHT);
windProg.setFont(new Font("Arial",Font.BOLD, 14));
windProg.setBorder(null);
windProg.setBounds(525,447,68,26);
airProg = new JTextField(airProgVar);
airProg.setEditable(false);
airProg.setBackground(backCOLOR);
airProg.setForeground(dunkelblauCOLOR);
airProg.setHorizontalAlignment(JTextField.RIGHT);
airProg.setFont(new Font("Arial",Font.BOLD, 14));
airProg.setBorder(null);
airProg.setBounds(698,338,68,26);
lightProg = new JTextField(lightProgVar);
lightProg.setEditable(false);
lightProg.setBackground(backCOLOR);
lightProg.setForeground(dunkelblauCOLOR);
lightProg.setHorizontalAlignment(JTextField.RIGHT);
lightProg.setFont(new Font("Arial",Font.BOLD, 14));
lightProg.setBorder(null);
lightProg.setBounds(698,392,68,26);
hintergrundContainer.add(prognosisButton);
hintergrundContainer.add(tempAkt);
hintergrundContainer.add(preAkt);
hintergrundContainer.add(windAkt);
hintergrundContainer.add(airAkt);
hintergrundContainer.add(lightAkt);
hintergrundContainer.add(tempProg);
hintergrundContainer.add(preProg);
hintergrundContainer.add(windProg);
hintergrundContainer.add(airProg);
hintergrundContainer.add(lightProg);
}
public void start()
{
}
}
und gibt es die möglichkeit die textfelder alle gleich zu formatieren, dass ich das nicht für jeden einzeln mache, wie bisher?