0% found this document useful (0 votes)
20 views12 pages

Paredes Danny T3 P2

Uploaded by

Danny Paredes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views12 pages

Paredes Danny T3 P2

Uploaded by

Danny Paredes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

NOMBRE:

PAREDES VENEGAS DANNY ARIEL

FECHA:

07/JULIO

TEMA:

GESTIÓN INFORMACIÓN ENSAMBLAJE DE UN PROYECTOR Y


PC T_3

ING:

JAVIER MONTALUISA

MATERIA:

PROGRAMACION ORIENTADO A OBJETOS


(POO)
2024
JFRAME FORM
/*
* 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 com.mycompany.pryproyectorpc;

import javax.swing.DefaultListModel;

/**
*
* @author labctr
*/
public class frmEnsamblaje extends javax.swing.JFrame {
DefaultListModel<String> modelPc = new DefaultListModel<>();
DefaultListModel<String> modelProyector = new DefaultListModel<>();
/**
* Creates new form frmEnsamblaje
*/
public frmEnsamblaje() {
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">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
lstComponentes = new javax.swing.JList<>();
btnPasar = new javax.swing.JButton();
btnPasartodo = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
lstProyector = new javax.swing.JList<>();
jScrollPane3 = new javax.swing.JScrollPane();
lstPc = new javax.swing.JList<>();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
btnEliminar = new javax.swing.JButton();
cmbSeleccionar = new javax.swing.JComboBox<>();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setText("COMPONENTES");

lstComponentes.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Procesador", "Lámpara o fuente de luz", "Placa base",
"Óptica", "Memoria RAM", "Panel de visualización", "Sistema de refrigeración",
"Tarjeta gráfica", "Conectividad (HDMI, VGA, etc.)", "Almacenamiento (SSD/HDD)",
"Carcasa o chasis", "Fuente de alimentación", "Controles y ajustes", "Periféricos
(teclado, ratón)", "Altavoz integrado", "Monitor", "Botones físicos", "Ventilador",
"Sistema operativo", "Soporte de montaje", "GPU (Unidad de Procesamiento Gráfico)",
"Prisma de color", "SSD (Unidad de Estado Sólido)", "Disipador térmico", "Control
remoto", "Teclado mecánico", "LED RGB", "DLP (Procesamiento de Luz Digital)",
"macOS (Sistema Operativo)", "Windows (Sistema Operativo)" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
lstComponentes.addListSelectionListener(new
javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
lstComponentesValueChanged(evt);
}
});
jScrollPane1.setViewportView(lstComponentes);

btnPasar.setText(">");
btnPasar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPasarActionPerformed(evt);
}
});

btnPasartodo.setText(">>");
btnPasartodo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPasartodoActionPerformed(evt);
}
});

lstProyector.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
lstProyectorValueChanged(evt);
}
});
jScrollPane2.setViewportView(lstProyector);

lstPc.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
lstPcValueChanged(evt);
}
});
jScrollPane3.setViewportView(lstPc);
jLabel2.setText("PC");

jLabel3.setText("Proyector");

btnEliminar.setText("X");
btnEliminar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEliminarActionPerformed(evt);
}
});

cmbSeleccionar.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {


"SELECCIONE", "PC", "Proyector" }));
cmbSeleccionar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmbSeleccionarActionPerformed(evt);
}
});

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(16, 16, 16)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 187,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(33, 33, 33)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(btnPasartodo,
javax.swing.GroupLayout.PREFERRED_SIZE, 46,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnPasar,
javax.swing.GroupLayout.PREFERRED_SIZE, 46,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cmbSeleccionar,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addGap(66, 66, 66)
.addComponent(jLabel1)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
18, Short.MAX_VALUE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3,
javax.swing.GroupLayout.PREFERRED_SIZE, 170,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane2,
javax.swing.GroupLayout.PREFERRED_SIZE, 170,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(18, 18, 18)
.addComponent(btnEliminar,
javax.swing.GroupLayout.PREFERRED_SIZE, 41,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(63, 63, 63))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 229,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3,
javax.swing.GroupLayout.PREFERRED_SIZE, 99,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(35, 35, 35)
.addComponent(cmbSeleccionar,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btnPasar,
javax.swing.GroupLayout.PREFERRED_SIZE, 35,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(btnEliminar,
javax.swing.GroupLayout.PREFERRED_SIZE, 40,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2,
javax.swing.GroupLayout.PREFERRED_SIZE, 99,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnPasartodo,
javax.swing.GroupLayout.PREFERRED_SIZE, 38,
javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addContainerGap(12, Short.MAX_VALUE))
);

pack();
}// </editor-fold>

private void cmbSeleccionarActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
}

private void btnPasarActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
int indexSeleccionado = cmbSeleccionar.getSelectedIndex();

if (indexSeleccionado == 1) {
String value = lstComponentes.getSelectedValue();
if (value != null) {
modelPc.addElement(value);
lstPc.setModel(modelPc);
}
} else if (indexSeleccionado == 2) {
String value = lstComponentes.getSelectedValue();
if (value != null) {
modelProyector.addElement(value);
lstProyector.setModel(modelProyector);
}
}
cmbSeleccionar.setSelectedIndex(0);
}

private void btnPasartodoActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
int indexSeleccionado = cmbSeleccionar.getSelectedIndex();

if (indexSeleccionado == 1) {
modelPc.clear();
for (int index : lstComponentes.getSelectedIndices()) {
modelPc.addElement(lstComponentes.getModel().getElementAt(index));
}
lstPc.setModel(modelPc);
} else if (indexSeleccionado == 2) {
modelProyector.clear();
for (int index : lstComponentes.getSelectedIndices()) {
modelProyector.addElement(lstComponentes.getModel().getElementAt(index));
}
lstProyector.setModel(modelProyector);
}
cmbSeleccionar.setSelectedIndex(0);
}

private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
if (!lstPc.isSelectionEmpty()) {
for (String value : lstPc.getSelectedValuesList()) {
modelPc.removeElement(value);
}
} else if (!lstProyector.isSelectionEmpty()) {
for (String value : lstProyector.getSelectedValuesList()) {
modelProyector.removeElement(value);
}
}
}

private void lstComponentesValueChanged(javax.swing.event.ListSelectionEvent evt) {


// TODO add your handling code here:

private void lstPcValueChanged(javax.swing.event.ListSelectionEvent evt) {


// TODO add your handling code here:

private void lstProyectorValueChanged(javax.swing.event.ListSelectionEvent evt) {


// TODO add your handling code here:

/**
* @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 (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(frmEnsamblaje.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(frmEnsamblaje.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(frmEnsamblaje.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(frmEnsamblaje.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new frmEnsamblaje().setVisible(true);
}
});
}

// Variables declaration - do not modify


private javax.swing.JButton btnEliminar;
private javax.swing.JButton btnPasar;
private javax.swing.JButton btnPasartodo;
private javax.swing.JComboBox<String> cmbSeleccionar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JList<String> lstComponentes;
private javax.swing.JList<String> lstPc;
private javax.swing.JList<String> lstProyector;
// End of variables declaration
}

You might also like