Your SlideShare is downloading. ×
Interfaz Grafica En Java
Interfaz Grafica En Java
Interfaz Grafica En Java
Interfaz Grafica En Java
Interfaz Grafica En Java
Interfaz Grafica En Java
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Interfaz Grafica En Java

908

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
908
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. import javax.swing.*;public class EjemploVentana{ public static void main(String[]args){ Ventana ven= new Ventana(); ven.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ven.setVisible(true);//Donde Diga .show Se Cambia Por .setVisible }}class Ventana extends JFrame{ public Ventana(){ super("Nombre De la Ventana"); setSize(1200,700); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import java.awt.*;class MiPanel extends JPanel{ public void paintComponent(Graphics g){ super.paintComponent(g); g.drawRect(20,20,80,80); }}class Ventana extends JFrame{ public Ventana(){ getContentPane().add(new MiPanel()); setSize(300,200); }}public class EjemploVentana2{ public static void main(String[] arge){ Ventana ven = new Ventana(); ven.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ven.setVisible(true); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class Ventana1 extends JFrame{ public Ventana1(){ Container c = getContentPane(); c.setLayout(new FlowLayout()); JPanel p = new JPanel(); p.add(new JLabel("Ejemplo De Un JPanel")); c.add(p); setSize(200,200); setVisible(true); } public static void main(String[] args){ new Ventana1(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;
  • 2. import java.awt.*;public class Ventana2 extends JFrame{ public Ventana2(String fich){ Container c = getContentPane(); c.setLayout(new FlowLayout()); ImageIcon ii = new ImageIcon(fich); c.add(new JLabel("Ejemplo De Una Imagen",JLabel.CENTER)); c.add(new JLabel(ii,JLabel.CENTER)); setSize(600,500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String [] args){ new Ventana2(args[0]); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class Ventana3 extends JFrame{ public Ventana3(){ Container c = getContentPane(); c.setLayout(new FlowLayout()); JTextField campoTexto = new JTextField(20); c.add(new JLabel("Nombre",JLabel.LEFT)); c.add(campoTexto); setSize(650,500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new Ventana3(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class Ventana4 extends JFrame{ public Ventana4(){ Container c = getContentPane(); c.setLayout(new FlowLayout()); JTextArea area = new JTextArea(8,20); c.add(new JLabel("Observaciones")); c.add(area); setSize(350,200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new Ventana4(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class Ventana5 extends JFrame{ public Ventana5(){ Container c = getContentPane();
  • 3. c.setLayout(new FlowLayout()); JButton b1 = new JButton("Aceptar"); JButton b2 = new JButton("Cancelar"); c.add(b1); c.add(b2); setSize(350,200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new Ventana5(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class Ventana6 extends JFrame{ public Ventana6(){ Container c = getContentPane(); c.setLayout(new FlowLayout()); JCheckBox cb = new JCheckBox("Pizara"); cb.setFont(new Font("Arial",Font.PLAIN,20)); c.add(cb); setSize(200,200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new Ventana6(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class Ventana7 extends JFrame{ public Ventana7(){ Container c = getContentPane(); c.setLayout(new FlowLayout()); JRadioButton rb = new JRadioButton("Pizarra"); JRadioButton op2 = new JRadioButton("Marcador"); rb.setFont(new Font ("ALGERIAN",Font.PLAIN,20)); op2.setFont(new Font ("Jokerman",Font.PLAIN,30)); c.add(op2); c.add(rb); setSize(200,200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new Ventana7(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class Ventana8 extends JFrame{ public Ventana8(){ Container c = getContentPane();
  • 4. c.setLayout(new FlowLayout()); c.add(new JLabel("Selecciona El Tipo De Combustible")); Font fuente = new Font("ALGERIAN",Font.PLAIN,18); JRadioButton gas = new JRadioButton("Gasolina"); gas.setFont(fuente); JRadioButton die = new JRadioButton("Diesel"); die.setFont(fuente); //Agupacion ButtonGroup grupo = new ButtonGroup(); grupo.add(gas); grupo.add(die); JPanel radioPanel = new JPanel(); radioPanel.setLayout(new GridLayout(0,1)); radioPanel.add(gas); radioPanel.add(die); c.add(radioPanel); setSize(300,300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new Ventana8(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class Ventana9 extends JFrame{ public Ventana9(){ Container c = getContentPane(); c.setLayout(new FlowLayout()); JComboBox cb = new JComboBox(); cb.setFont(new Font("ALGERIAN",Font.PLAIN,20)); cb.addItem("Pizarra"); cb.addItem("Pantalla"); cb.addItem("Proyector"); c.add(cb); setSize(200,200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new Ventana9(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class Ventana10 extends JFrame{ public Ventana10(){ Container c = getContentPane(); c.setLayout(new FlowLayout()); String[] datos = {"Pizarra","Pantalla","Proyector","ETC"}; JList lista = new JList(datos); c.add(lista); setSize(200,200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){
  • 5. new Ventana10(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import java.awt.*;public class Ventana11 extends JFrame{ public Ventana11(){ Container cp = getContentPane(); cp.setLayout(new BorderLayout()); final String[] nombreCol = {"Sesion","Tema","Fecha","Aula"}; Object [][] datos={ {"1","MySQL","12-07-04","5"},{"2","MySQL","13-07-04","5"},{"3","JDbC","14-07-04","5"},{"4","GUI","15-07-04","5"},{"1","Proyecto","16-07-04","5"}}; JTable tabla = new JTable(datos,nombreCol); tabla.setFont(new Font("ALGERIAN",Font.BOLD,20)); tabla.setRowHeight(24); JScrollPane jsp = new JScrollPane(tabla); cp.add(jsp,BorderLayout.CENTER); setSize(600,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new Ventana11(); }}
  • 6. new Ventana10(); }}-----------------------------------------------------------------------------------------------------------------------------------import javax.swing.*;import java.awt.*;public class Ventana11 extends JFrame{ public Ventana11(){ Container cp = getContentPane(); cp.setLayout(new BorderLayout()); final String[] nombreCol = {"Sesion","Tema","Fecha","Aula"}; Object [][] datos={ {"1","MySQL","12-07-04","5"},{"2","MySQL","13-07-04","5"},{"3","JDbC","14-07-04","5"},{"4","GUI","15-07-04","5"},{"1","Proyecto","16-07-04","5"}}; JTable tabla = new JTable(datos,nombreCol); tabla.setFont(new Font("ALGERIAN",Font.BOLD,20)); tabla.setRowHeight(24); JScrollPane jsp = new JScrollPane(tabla); cp.add(jsp,BorderLayout.CENTER); setSize(600,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args){ new Ventana11(); }}

×