Vereis tengo varios problemitas.
Código :
import java.awt.*; import javax.swing.*; import java.awt.event.*; import com.sun.java.swing.plaf.motif.MotifLookAndFeel; public class ProyectoSwing extends JApplet{ JButton b0,b1,b2,b3,b4; JLabel t0,t1; String s = "Este es un texto a modo de PRUEBA."; public void init(){ Container contentPane = getContentPane(); Container contentPane2 = getContentPane(); contentPane.add(new jPanel(), BorderLayout.WEST); contentPane2.add(new Jlabel(),BorderLayout.NORTH); } class jPanel extends JPanel implements ActionListener{ public jPanel(){ setLayout(new GridLayout(5,1,5,5)); JButton b0 = new JButton ("boton1"); add(b0); b0.addActionListener(this); JButton b1 = new JButton ("boton2"); add(b1); b1.addActionListener(this); JButton b2 = new JButton("boton3"); add(b2); b2.addActionListener(this); JButton b3 = new JButton ("boton4"); add(b3); b3.addActionListener(this); JButton b4 = new JButton("boton5"); add(b4); b4.addActionListener(this); } public void actionPerformed(ActionEvent e){ try{ if((JButton)e.getSource() == b1) UIManager.setLookAndFeel("com.sum.java.swing.plaf.motif.MotifLookAndFeel"); }catch(Exception ex){} SwingUtilities.updateComponentTreeUI(getContentPane()); } } class Jlabel extends JPanel{ public Jlabel(){ setLayout(new BorderLayout()); JLabel t0 = new JLabel(s); add("West",t0); JLabel t1 = new JLabel("",new ImageIcon("banner.gif"),JLabel.CENTER); add("South",t1); } } }
Lo primero es que quiero insertar una imágen en la parte de arriba y no sale.
Lo segundo que cuando aprieto un botón(b1) no carga la apariencia Motif.
Y ya lo tercero, como puedo crear desde un botón en java, un enlace con otro página.
A ver si alguien me puede orientar.
Muchas gracias.