import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import Geschäftslogik.BearbeitenDialog2GL;
import Model.Start;
/**
* @author Administrator
*
*/
public class BearbeitenDialog2 extends JDialog {
/**
*
*/
private static final long serialVersionUID = 1L;
BearbeitenDialog2GL bearbeitenGL = new BearbeitenDialog2GL();
/**
* @param mainframe
*/
public BearbeitenDialog2(JFrame mainframe) {
// TODO Auto-generated constructor stub
new JDialog(Start.getInstance().getHauptWindow(), true);
setTitle("Wört verschieben");
setLocationByPlatform(true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setSize(1024, 768);
add(mainPanel());
pack();
setVisible(true);
}
public JPanel mainPanel() {
JPanel hauptPanel = new JPanel();
hauptPanel.setLayout(new BoxLayout(hauptPanel,BoxLayout.PAGE_AXIS));
hauptPanel.add(hinweisPanel());
hauptPanel.add(verschiebeWortZuBezhPanel());
return hauptPanel;
}
public JPanel hinweisPanel() {
JPanel hinweisPanel = new JPanel();
hinweisPanel.setLayout(new BoxLayout(hinweisPanel, BoxLayout.LINE_AXIS));
hinweisPanel.setBorder(BorderFactory.createTitledBorder("!Hinweis!"));
JPanel textPanel = new JPanel(new FlowLayout(FlowLayout.LEFT,10,0));
JLabel hinweisLabel = new JLabel("Geben Sie das gesuchte Wort ein, klicken Sie auf 'suchen',\n markieren Sie die gewünschten Wörter und klicken Sie 'Verschieben'!");
textPanel.add(hinweisLabel);
hinweisPanel.add(textPanel);
return hinweisPanel;
}
public JPanel verschiebeWortZuBezhPanel() {
JPanel hauptPanel = new JPanel();
hauptPanel.setLayout(new BoxLayout(hauptPanel, BoxLayout.PAGE_AXIS));
hauptPanel.setBorder(BorderFactory.createTitledBorder("Verschieben"));
JPanel obenPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JLabel wortLabel = new JLabel("Wort eingeben: ");
JTextField wortField = new JTextField();
wortField.setPreferredSize(new Dimension(150, 25));
JButton suchenButton = new JButton("Suchen");
JList wortListe = new JList();
wortListe.setPreferredSize(new Dimension(200,200));
wortListe.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
obenPanel.add(wortLabel);
obenPanel.add(wortField);
obenPanel.add(suchenButton);
obenPanel.add(new JScrollPane(wortListe));
JPanel mittePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton verschiebeButton = new JButton("Verschieben");
mittePanel.add(verschiebeButton);
hauptPanel.add(obenPanel);
hauptPanel.add(mittePanel);
suchenButton.addActionListener(bearbeitenGL.wort1SuchenButtonAction(wortField, wortListe));
verschiebeButton.addActionListener(bearbeitenGL.verschiebenButtonAction(wortListe));
return hauptPanel;
}
}