Beruflich Dokumente
Kultur Dokumente
OBJETIVOS:
REQUERIMIENTOS:
PC con Windows.
jdk-6u10-windows-i586-p.exe
netbeans-6.5-ml-windows.exe
a. Cree un nuevo proyecto de tipo Java Application y en la opcin Project Name coloque
pEventoComBox, y en la opcin Create Main Class coloque:
peventocombox.CEventoComBox, luego haga click en Finish
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public CEventoComBox()
{
addWindowListener( new WindowAdapter()
{ public void windowClosing(WindowEvent e) { System.exit(0); } });
// Panel Inferior
PanelSur = new JPanel();
Colores = new JComboBox(Items);
PanelSur.add(Colores);
Colores.addActionListener(this);
cMain.add(PanelSur, BorderLayout.SOUTH);
cMain.add(PanelCentro, BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent evt)
{
JComboBox CmbOrigen = (JComboBox)evt.getSource();
if((String)CmbOrigen.getSelectedItem() == "Verde")
color = Color.GREEN;
else if((String)CmbOrigen.getSelectedItem() == "Amarillo")
color = Color.YELLOW;
else if((String)CmbOrigen.getSelectedItem() == "Azul")
color = Color.BLUE;
else if((String)CmbOrigen.getSelectedItem() == "Blanco")
color = Color.WHITE;
Resultado:
a. Cree un nuevo proyecto de tipo Java Application y en la opcin Project Name coloque
pEventoList, y en la opcin Create Main Class coloque: peventolist.CEventoList, luego
haga click en Finish
import java.awt.*;
public CEventoList()
{
addWindowListener( new WindowAdapter()
{ public void windowClosing(WindowEvent e) { System.exit(0); } });
//Panel de Frutas
PanelFruta = new JPanel();
PanelFruta.add(new JScrollPane(LstFruta));
PanelFruta.add(LblItem);
cMain.add(PanelFruta);
}
public static void main(String[] args)
{
CEventoList oList = new CEventoList();
oList.setVisible(true);
}
}
Resultado:
a. Cree un nuevo proyecto de tipo Java Application y en la opcin Project Name coloque
pEventListSel, y en la opcin Create Main Class coloque: peventlistsel.CEventListSel,
luego haga click en Finish
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public CEventListSel()
{
addWindowListener( new WindowAdapter()
{ public void windowClosing(WindowEvent e) { System.exit(0); } });
//Panel
PanelMain = new JPanel();
PanelMain.add(new JScrollPane(LstOrigen));
PanelMain.add(new JScrollPane(LstDestino));
LstOrigen.addListSelectionListener(new ListSelectionListener()
{ public void valueChanged(ListSelectionEvent e)
{ LstDestino.setListData(LstOrigen.getSelectedValues()); }
} );
oMain.add(PanelMain);
}
Resultado: