This commit is contained in:
2025-10-13 11:08:37 +02:00
commit 26ebdc7aba
9 changed files with 868 additions and 0 deletions

BIN
ies.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

13
pom.xml Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>contenedores</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>24</maven.compiler.release>
<exec.mainClass>com.mycompany.contenedores.Contenedores</exec.mainClass>
</properties>
</project>

View File

@@ -0,0 +1,27 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package com.mycompany.contenedores;
import controlador.Controlador;
import modelo.Modelo;
import vista.Vista;
/**
*
* @author antonio
*/
public class Contenedores {
public static void main(String[] args) {
Vista vista=new Vista();
Modelo modelo=new Modelo();
Controlador programa=new Controlador(vista,modelo);
programa.Iniciar();
}
}

View File

@@ -0,0 +1,142 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package controlador;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import javax.swing.JColorChooser;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import modelo.Modelo;
import vista.Vista;
import vista.Vista2;
/**
*
* @author antonio
*/
public class Controlador implements ActionListener{
public Vista vista;
public Modelo modelo;
public Vista2 vista2;
public Controlador(Vista _vista, Modelo _modelo) {
this.vista = _vista;
this.modelo = _modelo;
this.vista.btn_modal.addActionListener(this);
this.vista.btn_no_modal.addActionListener(this);
this.vista.btn_unica.addActionListener(this);
//this.vista2.btn_jop_msg.addActionListener(eal->JOptionPane.showConfirmDialog(vista2, "Hola", "Este es el titulo",0));
}
public void creaListenersVista2(Vista2 vista2)//solo si existe vista2 (el jdialog)
{
vista2.addWindowListener(new WindowAdapter()
{
//es necesario ya que nada volverá a hacer visible la ventana oculta.
@Override
public void windowClosing(WindowEvent we)
{
vista.setVisible(true);
}
});
vista2.btn_jop_msg.addActionListener(eal->JOptionPane.showConfirmDialog(vista2, "Hola", "Este es el titulo",0));
vista2.btn_imput_msg.addActionListener(eal->JOptionPane.showInternalConfirmDialog(null, "Hola"));
vista2.btn_salir.addActionListener(eal->
{
vista2.setVisible(false); // TODO add your handling code here:
vista.setVisible(true);
vista2.dispose();
});
vista2.btn_file.addActionListener(eal->
{
JFileChooser OpenFile=new JFileChooser();
OpenFile.showOpenDialog(vista2);
//System.out.println(OpenFile.getSelectedFile().toString());
modelo.file=OpenFile.getSelectedFile();
});
vista2.btn_color.addActionListener(eal->
{
Color color=JColorChooser.showDialog(vista2, "Selecciona color", vista2.getBackground());
vista.PanelBotones.setBackground(color);
System.out.println(color.toString());
});
}
@Override
public void actionPerformed(ActionEvent e)
{
Object source=e.getSource();
try
{
if (source==vista.btn_modal)
{
Vista2 vista2=new Vista2(vista,true);
this.creaListenersVista2(vista2);
vista2.setVisible(true);
}
else if (source==vista.btn_no_modal)
{
Vista2 vista2=new Vista2(vista,false);
this.creaListenersVista2(vista2);
vista2.setVisible(true);
}
else if (source==vista.btn_unica)
{
vista.setVisible(false);
Vista2 vista2=new Vista2(vista,false);
this.creaListenersVista2(vista2);
vista2.setVisible(true);
/*vista2.addWindowListener(new WindowAdapter()
{
//es necesario ya que nada volverá a hacer visible la ventana oculta.
@Override
public void windowClosing(WindowEvent we)
{
vista.setVisible(true);
}
});
vista2.btn_jop_msg.addActionListener(eal->JOptionPane.showConfirmDialog(vista2, "Hola", "Este es el titulo",0));
vista2.btn_imput_msg.addActionListener(eal->JOptionPane.showInternalConfirmDialog(null, "Hola"));
vista2.btn_salir.addActionListener(eal->
{
vista2.setVisible(false); // TODO add your handling code here:
vista.setVisible(true);
vista2.dispose();
});
vista2.btn_file.addActionListener(eal->
{
JFileChooser OpenFile=new JFileChooser();
OpenFile.showOpenDialog(vista2);
//System.out.println(OpenFile.getSelectedFile().toString());
modelo.file=OpenFile.getSelectedFile();
});*/
}
}
catch (Exception ex)
{
JOptionPane.showMessageDialog(null,ex.getMessage());
}
}
public void Iniciar(){
this.vista.setVisible(true);
}
}

View File

@@ -0,0 +1,16 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package modelo;
import java.io.File;
/**
*
* @author antonio
*/
public class Modelo {
public File file;
}

View File

@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Menu class="javax.swing.JMenuBar" name="jMenuBar1">
<SubComponents>
<Menu class="javax.swing.JMenu" name="jMenu1">
<Properties>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu2">
<Properties>
<Property name="text" type="java.lang.String" value="Edit"/>
</Properties>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="Ejemplo"/>
<Property name="autoRequestFocus" type="boolean" value="false"/>
<Property name="iconImage" type="java.awt.Image" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="Toolkit.getDefaultToolkit().getImage(&quot;ies.png&quot;)" type="code"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane2" min="-2" pref="457" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="PanelBotones" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane2" max="32767" attributes="0"/>
<Component id="PanelBotones" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTextArea2">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
<Property name="text" type="java.lang.String" value="Ventana (JFrame): es un formulario con t&#xed;tulo, &#xa;los botones para maximizar, minimizar o cerrar y borde.&#xa;Aparece un icono por defecto en forma de taza de caf&#xe9;&#xa;que puedes modificar, y puede contener una &#xa;barra de men&#xfa;."/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="PanelBotones">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btn_no_modal" max="32767" attributes="0"/>
<Component id="btn_modal" max="32767" attributes="0"/>
<Component id="btn_unica" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="btn_no_modal" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="btn_modal" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="btn_unica" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="153" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="btn_no_modal">
<Properties>
<Property name="text" type="java.lang.String" value="Ventana no Modal"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn_no_modalActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="btn_modal">
<Properties>
<Property name="text" type="java.lang.String" value="Ventana Modal"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn_modalActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="btn_unica">
<Properties>
<Property name="text" type="java.lang.String" value="Ventana &#xfa;nica"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn_unicaActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@@ -0,0 +1,196 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package vista;
import java.awt.Toolkit;
/**
*
* @author antonio
*/
public class Vista extends javax.swing.JFrame {
private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(Vista.class.getName());
/**
* Creates new form Vista
*/
public Vista() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
PanelBotones = new javax.swing.JPanel();
btn_no_modal = new javax.swing.JButton();
btn_modal = new javax.swing.JButton();
btn_unica = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Ejemplo");
setAutoRequestFocus(false);
setIconImage(Toolkit.getDefaultToolkit().getImage("ies.png"));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
jTextArea2.setColumns(20);
jTextArea2.setRows(5);
jTextArea2.setText("Ventana (JFrame): es un formulario con título, \nlos botones para maximizar, minimizar o cerrar y borde.\nAparece un icono por defecto en forma de taza de café\nque puedes modificar, y puede contener una \nbarra de menú.");
jScrollPane2.setViewportView(jTextArea2);
btn_no_modal.setText("Ventana no Modal");
btn_no_modal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_no_modalActionPerformed(evt);
}
});
btn_modal.setText("Ventana Modal");
btn_modal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_modalActionPerformed(evt);
}
});
btn_unica.setText("Ventana única");
btn_unica.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_unicaActionPerformed(evt);
}
});
javax.swing.GroupLayout PanelBotonesLayout = new javax.swing.GroupLayout(PanelBotones);
PanelBotones.setLayout(PanelBotonesLayout);
PanelBotonesLayout.setHorizontalGroup(
PanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelBotonesLayout.createSequentialGroup()
.addContainerGap()
.addGroup(PanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_no_modal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn_modal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn_unica, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
PanelBotonesLayout.setVerticalGroup(
PanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelBotonesLayout.createSequentialGroup()
.addContainerGap()
.addComponent(btn_no_modal)
.addGap(18, 18, 18)
.addComponent(btn_modal)
.addGap(18, 18, 18)
.addComponent(btn_unica)
.addContainerGap(153, Short.MAX_VALUE))
);
jMenu1.setText("File");
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 457, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(PanelBotones, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2)
.addComponent(PanelBotones, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btn_no_modalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_no_modalActionPerformed
//this.setVisible(false);
//Vista2 vista2=new Vista2(this,false);
//vista2.setVisible(true);
// TODO add your handling code here:
}//GEN-LAST:event_btn_no_modalActionPerformed
private void btn_modalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_modalActionPerformed
//this.setVisible(false);
//Vista2 vista2=new Vista2(this,true);
//vista2.setVisible(true); // TODO add your handling code here:
}//GEN-LAST:event_btn_modalActionPerformed
private void btn_unicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_unicaActionPerformed
//this.setVisible(false);
//Vista2 vista2=new Vista2(this,false);
//vista2.setVisible(true);
// TODO add your handling code here:
}//GEN-LAST:event_btn_unicaActionPerformed
private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
// TODO add your handling code here:
}//GEN-LAST:event_formWindowClosed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ReflectiveOperationException | javax.swing.UnsupportedLookAndFeelException ex) {
logger.log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(() -> new Vista().setVisible(true));
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JPanel PanelBotones;
public javax.swing.JButton btn_modal;
public javax.swing.JButton btn_no_modal;
public javax.swing.JButton btn_unica;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextArea jTextArea2;
// End of variables declaration//GEN-END:variables
}

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<NonVisualComponents>
<Component class="javax.swing.JFileChooser" name="jFileChooser1">
</Component>
<Component class="javax.swing.JColorChooser" name="jColorChooser1">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="autoRequestFocus" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="btn_salir" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="57" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btn_imput_msg" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="btn_jop_msg" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btn_file" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btn_color" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="125" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btn_jop_msg" min="-2" max="-2" attributes="0"/>
<Component id="btn_file" min="-2" max="-2" attributes="0"/>
<Component id="btn_color" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="btn_imput_msg" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="131" max="32767" attributes="0"/>
<Component id="btn_salir" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="49" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="btn_salir">
<Properties>
<Property name="text" type="java.lang.String" value="SALIR"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn_salirActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="java.awt.Button" name="btn_jop_msg">
<Properties>
<Property name="label" type="java.lang.String" value="JOptionPane"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn_jop_msgActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="java.awt.Button" name="btn_file">
<Properties>
<Property name="label" type="java.lang.String" value="button1"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn_fileActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="java.awt.Button" name="btn_color">
<Properties>
<Property name="label" type="java.lang.String" value="button1"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="java.awt.Button" name="btn_imput_msg">
<Properties>
<Property name="label" type="java.lang.String" value="JOptionPane"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn_imput_msgActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
</SubComponents>
</Form>

View File

@@ -0,0 +1,188 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JDialog.java to edit this template
*/
package vista;
import javax.swing.JOptionPane;
import java.awt.Toolkit;
import java.io.File;
import javax.swing.Icon;
import javax.swing.JFileChooser;
/**
*
* @author antonio
*/
public class Vista2 extends javax.swing.JDialog {
private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(Vista2.class.getName());
private Vista vista;
/**
* Creates new form Vista2
*/
public Vista2(java.awt.Frame parent, boolean modal) {
super(parent, modal);
vista=(Vista) parent;
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jFileChooser1 = new javax.swing.JFileChooser();
jColorChooser1 = new javax.swing.JColorChooser();
btn_salir = new javax.swing.JButton();
btn_jop_msg = new java.awt.Button();
btn_file = new java.awt.Button();
btn_color = new java.awt.Button();
btn_imput_msg = new java.awt.Button();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setAutoRequestFocus(false);
btn_salir.setText("SALIR");
btn_salir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_salirActionPerformed(evt);
}
});
btn_jop_msg.setLabel("JOptionPane");
btn_jop_msg.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_jop_msgActionPerformed(evt);
}
});
btn_file.setLabel("button1");
btn_file.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_fileActionPerformed(evt);
}
});
btn_color.setLabel("button1");
btn_imput_msg.setLabel("JOptionPane");
btn_imput_msg.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_imput_msgActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn_salir)
.addGap(57, 57, 57))
.addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_imput_msg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(btn_jop_msg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn_file, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn_color, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(125, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(39, 39, 39)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_jop_msg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn_file, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn_color, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn_imput_msg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 131, Short.MAX_VALUE)
.addComponent(btn_salir)
.addGap(49, 49, 49))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btn_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_salirActionPerformed
//setVisible(false); // TODO add your handling code here:
//vista.setVisible(true);
//this.dispose();
}//GEN-LAST:event_btn_salirActionPerformed
private void btn_jop_msgActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_jop_msgActionPerformed
//JOptionPane.showConfirmDialog(null, "Hola", "Este es el titulo",0);
// TODO add your handling code here:Toolkit.getDefaultToolkit().getImage("ies.png")
}//GEN-LAST:event_btn_jop_msgActionPerformed
private void btn_imput_msgActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_imput_msgActionPerformed
//JOptionPane.showInternalConfirmDialog(null, "Hola");
// TODO add your handling code here:
}//GEN-LAST:event_btn_imput_msgActionPerformed
private void btn_fileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_fileActionPerformed
/*JFileChooser OpenFile=new JFileChooser();
OpenFile.showOpenDialog(this);
System.out.println(OpenFile.getSelectedFile().toString());
File file=OpenFile.getSelectedFile();*/
}//GEN-LAST:event_btn_fileActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ReflectiveOperationException | javax.swing.UnsupportedLookAndFeelException ex) {
logger.log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
Vista2 dialog = new Vista2(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public java.awt.Button btn_color;
public java.awt.Button btn_file;
public java.awt.Button btn_imput_msg;
public java.awt.Button btn_jop_msg;
public javax.swing.JButton btn_salir;
private javax.swing.JColorChooser jColorChooser1;
private javax.swing.JFileChooser jFileChooser1;
// End of variables declaration//GEN-END:variables
}