package FSWING2;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Ejercicio1 {
public static void main(String[] args) {
JFrame Ventana = new JFrame();
Ventana.setTitle("Ejercicio 1");
JPanel general= new JPanel(new BorderLayout());
JPanel panela = new JPanel(new GridLayout(2,1));
JPanel panelb = new JPanel();
JPanel panelc = new JPanel();
JPanel Pcombo = new JPanel();
JPanel Plabel = new JPanel();
JLabel etiqueta = new JLabel("Seleccionar imagen en el JComboBox");
etiqueta.setForeground(java.awt.Color.red);
String[] lista = { "SELECCIONE" };
JComboBox combo = new JComboBox(lista);
JLabel imagen = new JLabel();
imagen.setIcon(new ImageIcon("src/FSWING2/logo.jpg"));
JButton boton1 = new JButton("SALIR");
JButton boton2 = new JButton("ALUMNO: ");
JTextField text = new JTextField("",10);
text.setBackground(java.awt.Color.blue);
Plabel.add(etiqueta);
Pcombo.add(combo);
panela.add(Plabel);
panela.add(Pcombo);
panelb.add(boton1);
panelb.add(boton2);
panelb.add(text);
panelc.add(imagen);
Ventana.add(general);
general.add(panela, BorderLayout.NORTH);
general.add(panelc, BorderLayout.CENTER);
general.add(panelb, BorderLayout.SOUTH);
Ventana.setSize(400, 400);
Ventana.setTitle("Combobox jlabel");
Ventana.setVisible(true);
}}
package FSWING2;
import java.awt.*;
import javax.swing.*;
public class Ejercicio2 {
public static void main(String[] args) {
JFrame Ventana = new JFrame();
Ventana.setTitle("Ejercicio 2");
Ventana.setSize(400,300);
JPanel Panel=new JPanel(new BorderLayout());
JToolBar Barra= new JToolBar();
JButton Cortar= new JButton(new ImageIcon("src/FSWING2/cortar.jpg"));
Barra.add(Cortar);
JButton Copiar= new JButton(new ImageIcon("src/FSWING2/copiar.jpg"));
Barra.add(Copiar);
JButton Pegar= new JButton(new ImageIcon("src/FSWING2/pegar.jpg"));
Barra.add(Pegar);
Panel.add(Barra, BorderLayout.NORTH);
Ventana.add(Panel);
Ventana.setVisible(true);
}}
package FSWING2;
import java.awt.*;
import javax.swing.*;
import javax.swing.JFrame;
public class Ejercicio3 {
public static void main(String[] args) {
JFrame Ventana = new JFrame();
Ventana.setTitle("Ejercicio 3");
Ventana.setSize(400,300);
JPanel Grande=new JPanel(new BorderLayout());
JPanel Derecha=new JPanel();
Derecha.setLayout(new BoxLayout(Derecha,BoxLayout.Y_AXIS));
JButton ABT1=new JButton("Boton 1");
JButton ABT2=new JButton("Boton 2");
JButton ABT3=new JButton("Boton 3");
JButton ABT4=new JButton("Boton 4");
Derecha.add(ABT1);
Derecha.add(ABT2);
Derecha.add(ABT3);
Derecha.add(ABT4);
JPanel Debajo=new JPanel();
Debajo.setLayout(new BoxLayout(Debajo,BoxLayout.X_AXIS));
JButton BBT1=new JButton("Boton 1");
JButton BBT2=new JButton("Boton 2");
JButton BBT3=new JButton("Boton 3");
JButton BBT4=new JButton("Boton 4");
Debajo.add(BBT1);
Debajo.add(BBT2);
Debajo.add(BBT3);
Debajo.add(BBT4);
Grande.add(Derecha,BorderLayout.EAST);
Grande.add(Debajo,BorderLayout.SOUTH);
Ventana.add(Grande);
Ventana.setVisible(true);
}}
package FSWING2;
import javax.swing.*;
import java.awt.*;
public class Ejercicio4 {
public static void main(String[] args) {
JFrame Ventana = new JFrame();
JPanel General = new JPanel();
SpringLayout lay = new SpringLayout();
General.setLayout(lay);
JButton boton1 = new JButton("Press 1");
JButton boton2 = new JButton("Press 2");
JButton boton3 = new JButton("Press 3");
JButton boton4 = new JButton("Press 4");
JButton boton5 = new JButton("Press 5");
JButton boton6 = new JButton("Press 6");
lay.putConstraint(SpringLayout.NORTH,boton1,50, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton1,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton2,100, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton2,100, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton3,100, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton3,200, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton4,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton4,50, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton5,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton5,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton6,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton6,250, SpringLayout.WEST,General);
Ventana.add(General);
General.add(boton1);
General.add(boton2);
General.add(boton3);
General.add(boton4);
General.add(boton5);
General.add(boton6);
Ventana.setVisible(true);
Ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Ventana.setSize(400,250);
}}
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Ejercicio1 {
public static void main(String[] args) {
JFrame Ventana = new JFrame();
Ventana.setTitle("Ejercicio 1");
JPanel general= new JPanel(new BorderLayout());
JPanel panela = new JPanel(new GridLayout(2,1));
JPanel panelb = new JPanel();
JPanel panelc = new JPanel();
JPanel Pcombo = new JPanel();
JPanel Plabel = new JPanel();
JLabel etiqueta = new JLabel("Seleccionar imagen en el JComboBox");
etiqueta.setForeground(java.awt.Color.red);
String[] lista = { "SELECCIONE" };
JComboBox combo = new JComboBox(lista);
JLabel imagen = new JLabel();
imagen.setIcon(new ImageIcon("src/FSWING2/logo.jpg"));
JButton boton1 = new JButton("SALIR");
JButton boton2 = new JButton("ALUMNO: ");
JTextField text = new JTextField("",10);
text.setBackground(java.awt.Color.blue);
Plabel.add(etiqueta);
Pcombo.add(combo);
panela.add(Plabel);
panela.add(Pcombo);
panelb.add(boton1);
panelb.add(boton2);
panelb.add(text);
panelc.add(imagen);
Ventana.add(general);
general.add(panela, BorderLayout.NORTH);
general.add(panelc, BorderLayout.CENTER);
general.add(panelb, BorderLayout.SOUTH);
Ventana.setSize(400, 400);
Ventana.setTitle("Combobox jlabel");
Ventana.setVisible(true);
}}
package FSWING2;
import java.awt.*;
import javax.swing.*;
public class Ejercicio2 {
public static void main(String[] args) {
JFrame Ventana = new JFrame();
Ventana.setTitle("Ejercicio 2");
Ventana.setSize(400,300);
JPanel Panel=new JPanel(new BorderLayout());
JToolBar Barra= new JToolBar();
JButton Cortar= new JButton(new ImageIcon("src/FSWING2/cortar.jpg"));
Barra.add(Cortar);
JButton Copiar= new JButton(new ImageIcon("src/FSWING2/copiar.jpg"));
Barra.add(Copiar);
JButton Pegar= new JButton(new ImageIcon("src/FSWING2/pegar.jpg"));
Barra.add(Pegar);
Panel.add(Barra, BorderLayout.NORTH);
Ventana.add(Panel);
Ventana.setVisible(true);
}}
package FSWING2;
import java.awt.*;
import javax.swing.*;
import javax.swing.JFrame;
public class Ejercicio3 {
public static void main(String[] args) {
JFrame Ventana = new JFrame();
Ventana.setTitle("Ejercicio 3");
Ventana.setSize(400,300);
JPanel Grande=new JPanel(new BorderLayout());
JPanel Derecha=new JPanel();
Derecha.setLayout(new BoxLayout(Derecha,BoxLayout.Y_AXIS));
JButton ABT1=new JButton("Boton 1");
JButton ABT2=new JButton("Boton 2");
JButton ABT3=new JButton("Boton 3");
JButton ABT4=new JButton("Boton 4");
Derecha.add(ABT1);
Derecha.add(ABT2);
Derecha.add(ABT3);
Derecha.add(ABT4);
JPanel Debajo=new JPanel();
Debajo.setLayout(new BoxLayout(Debajo,BoxLayout.X_AXIS));
JButton BBT1=new JButton("Boton 1");
JButton BBT2=new JButton("Boton 2");
JButton BBT3=new JButton("Boton 3");
JButton BBT4=new JButton("Boton 4");
Debajo.add(BBT1);
Debajo.add(BBT2);
Debajo.add(BBT3);
Debajo.add(BBT4);
Grande.add(Derecha,BorderLayout.EAST);
Grande.add(Debajo,BorderLayout.SOUTH);
Ventana.add(Grande);
Ventana.setVisible(true);
}}
package FSWING2;
import javax.swing.*;
import java.awt.*;
public class Ejercicio4 {
public static void main(String[] args) {
JFrame Ventana = new JFrame();
JPanel General = new JPanel();
SpringLayout lay = new SpringLayout();
General.setLayout(lay);
JButton boton1 = new JButton("Press 1");
JButton boton2 = new JButton("Press 2");
JButton boton3 = new JButton("Press 3");
JButton boton4 = new JButton("Press 4");
JButton boton5 = new JButton("Press 5");
JButton boton6 = new JButton("Press 6");
lay.putConstraint(SpringLayout.NORTH,boton1,50, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton1,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton2,100, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton2,100, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton3,100, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton3,200, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton4,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton4,50, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton5,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton5,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.NORTH,boton6,150, SpringLayout.WEST,General);
lay.putConstraint(SpringLayout.WEST,boton6,250, SpringLayout.WEST,General);
Ventana.add(General);
General.add(boton1);
General.add(boton2);
General.add(boton3);
General.add(boton4);
General.add(boton5);
General.add(boton6);
Ventana.setVisible(true);
Ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Ventana.setSize(400,250);
}}
No hay comentarios:
Publicar un comentario