SlideShare a Scribd company logo
1 of 6
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.*;
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();
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();
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){
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();
      }
}
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();
      }
}

More Related Content

What's hot

Ramco C Question Paper 2003
Ramco  C  Question  Paper 2003Ramco  C  Question  Paper 2003
Ramco C Question Paper 2003
ncct
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
CODE BLUE
 

What's hot (20)

12c Mini Lesson - Better Defaults
12c Mini Lesson - Better Defaults12c Mini Lesson - Better Defaults
12c Mini Lesson - Better Defaults
 
The Ring programming language version 1.5.2 book - Part 74 of 181
The Ring programming language version 1.5.2 book - Part 74 of 181The Ring programming language version 1.5.2 book - Part 74 of 181
The Ring programming language version 1.5.2 book - Part 74 of 181
 
Numerical Methods with Computer Programming
Numerical Methods with Computer ProgrammingNumerical Methods with Computer Programming
Numerical Methods with Computer Programming
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
 
Tests unitaires pour PostgreSQL avec pgTap
Tests unitaires pour PostgreSQL avec pgTapTests unitaires pour PostgreSQL avec pgTap
Tests unitaires pour PostgreSQL avec pgTap
 
Stacki: Remove Commands
Stacki: Remove CommandsStacki: Remove Commands
Stacki: Remove Commands
 
How to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdbHow to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdb
 
PostgreSQL and PL/Java
PostgreSQL and PL/JavaPostgreSQL and PL/Java
PostgreSQL and PL/Java
 
Ramco C Question Paper 2003
Ramco  C  Question  Paper 2003Ramco  C  Question  Paper 2003
Ramco C Question Paper 2003
 
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
 
AST: threats and opportunities
AST: threats and opportunitiesAST: threats and opportunities
AST: threats and opportunities
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
Rのスコープとフレームと環境と
Rのスコープとフレームと環境とRのスコープとフレームと環境と
Rのスコープとフレームと環境と
 
Rich and Snappy Apps (No Scaling Required)
Rich and Snappy Apps (No Scaling Required)Rich and Snappy Apps (No Scaling Required)
Rich and Snappy Apps (No Scaling Required)
 
Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1
 
Java设置环境变量
Java设置环境变量Java设置环境变量
Java设置环境变量
 
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189
 
Async data pipelines for client-side JavaScript
Async data pipelines for client-side JavaScriptAsync data pipelines for client-side JavaScript
Async data pipelines for client-side JavaScript
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
 

Viewers also liked (8)

Bilangan bulat
Bilangan bulatBilangan bulat
Bilangan bulat
 
Taller interfaz 3
Taller interfaz 3Taller interfaz 3
Taller interfaz 3
 
Dogs walking on two legs
Dogs walking on two legsDogs walking on two legs
Dogs walking on two legs
 
Hechos en clase
Hechos en claseHechos en clase
Hechos en clase
 
Taller parcial
Taller parcialTaller parcial
Taller parcial
 
Pratica1
Pratica1Pratica1
Pratica1
 
Taller de string(java)
Taller de string(java)Taller de string(java)
Taller de string(java)
 
Configuración servidores DCHP, DNS y HTTP - Cisco Packet Tracer
Configuración servidores DCHP, DNS y HTTP - Cisco Packet TracerConfiguración servidores DCHP, DNS y HTTP - Cisco Packet Tracer
Configuración servidores DCHP, DNS y HTTP - Cisco Packet Tracer
 

Similar to Interfaz Grafica En Java

JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
Kiyotaka Oku
 
Add the rest of the calculations to the codeThe operations .pdf
Add the rest of the calculations to the codeThe operations .pdfAdd the rest of the calculations to the codeThe operations .pdf
Add the rest of the calculations to the codeThe operations .pdf
adityablinds
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdf
anushkaent7
 
Lab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docxLab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docx
DIPESH30
 

Similar to Interfaz Grafica En Java (12)

JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
Add the rest of the calculations to the codeThe operations .pdf
Add the rest of the calculations to the codeThe operations .pdfAdd the rest of the calculations to the codeThe operations .pdf
Add the rest of the calculations to the codeThe operations .pdf
 
Awt
AwtAwt
Awt
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
 
ETM Server
ETM ServerETM Server
ETM Server
 
Main class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdfMain class --------------------------import java.awt.FlowLayout.pdf
Main class --------------------------import java.awt.FlowLayout.pdf
 
Q 1
Q 1Q 1
Q 1
 
Stack, queue and hashing
Stack, queue and hashingStack, queue and hashing
Stack, queue and hashing
 
شرح مقرر البرمجة 2 لغة جافا - الوحدة التاسعة
شرح مقرر البرمجة 2   لغة جافا - الوحدة التاسعةشرح مقرر البرمجة 2   لغة جافا - الوحدة التاسعة
شرح مقرر البرمجة 2 لغة جافا - الوحدة التاسعة
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginners
 
Lab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docxLab08Lab08.cppLab08Lab08.cpp.docx
Lab08Lab08.cppLab08Lab08.cpp.docx
 

More from Řỉgö VẻGầ (18)

Laboratorio 4 1 introping
Laboratorio 4 1 intropingLaboratorio 4 1 introping
Laboratorio 4 1 introping
 
Laboratorio 3 mascara de subred
Laboratorio 3 mascara de subredLaboratorio 3 mascara de subred
Laboratorio 3 mascara de subred
 
Encuesta
EncuestaEncuesta
Encuesta
 
Taller 6
Taller 6Taller 6
Taller 6
 
Taller 5
Taller 5Taller 5
Taller 5
 
Taller 4
Taller 4Taller 4
Taller 4
 
Taller interfaz 2
Taller interfaz 2Taller interfaz 2
Taller interfaz 2
 
Taller1
Taller1Taller1
Taller1
 
Taller Matrices En Java
Taller Matrices En JavaTaller Matrices En Java
Taller Matrices En Java
 
Historia de la computacion, tipos de lenguaje de programacion e historia
Historia de la computacion, tipos de lenguaje de programacion e historiaHistoria de la computacion, tipos de lenguaje de programacion e historia
Historia de la computacion, tipos de lenguaje de programacion e historia
 
Ventajas y desventajas de las redes sociales
Ventajas y desventajas de las redes socialesVentajas y desventajas de las redes sociales
Ventajas y desventajas de las redes sociales
 
Ventajas y desventajas de las redes sociales
Ventajas y desventajas de las redes socialesVentajas y desventajas de las redes sociales
Ventajas y desventajas de las redes sociales
 
Leyes
LeyesLeyes
Leyes
 
Como fabricar queso
Como fabricar quesoComo fabricar queso
Como fabricar queso
 
Ventajas y desventajas de las redes sociales
Ventajas y desventajas de las redes socialesVentajas y desventajas de las redes sociales
Ventajas y desventajas de las redes sociales
 
Leyes
LeyesLeyes
Leyes
 
Como fabricar queso
Como fabricar quesoComo fabricar queso
Como fabricar queso
 
Mi Ropa Ares
Mi Ropa Ares Mi Ropa Ares
Mi Ropa Ares
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Interfaz Grafica En Java

  • 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(); } }