From da7301e3748126869f94ef0a51fde1afc6039956 Mon Sep 17 00:00:00 2001 From: Daniel Aberger Date: Mon, 30 Nov 2015 21:09:29 +0100 Subject: [PATCH] =?UTF-8?q?[ADDED]=20N=C3=A4chster=20und=20Vorheriger=20Bu?= =?UTF-8?q?tton=20[ADDED]=20AlertWindow=20f=C3=BCr=20sp=C3=A4ter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/ixab/GUI/AlertWindow.form | 64 +++++++++++++++++++++++++++++++ src/com/ixab/GUI/AlertWindow.java | 47 +++++++++++++++++++++++ src/com/ixab/GUI/MainWindow.form | 34 +++++++++++----- src/com/ixab/GUI/MainWindow.java | 28 +++++++++++++- src/com/ixab/Main.java | 3 +- 5 files changed, 165 insertions(+), 11 deletions(-) create mode 100644 src/com/ixab/GUI/AlertWindow.form create mode 100644 src/com/ixab/GUI/AlertWindow.java diff --git a/src/com/ixab/GUI/AlertWindow.form b/src/com/ixab/GUI/AlertWindow.form new file mode 100644 index 0000000..57f0e9d --- /dev/null +++ b/src/com/ixab/GUI/AlertWindow.form @@ -0,0 +1,64 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/com/ixab/GUI/AlertWindow.java b/src/com/ixab/GUI/AlertWindow.java new file mode 100644 index 0000000..6277496 --- /dev/null +++ b/src/com/ixab/GUI/AlertWindow.java @@ -0,0 +1,47 @@ +package com.ixab.GUI; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class AlertWindow extends JDialog { + private JPanel contentPane; + private JButton buttonOK; + private JLabel message; + + public AlertWindow(String s) { + message.setText(s); + setContentPane(contentPane); + setModal(true); + getRootPane().setDefaultButton(buttonOK); + + buttonOK.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + onOK(); + } + }); + } + + private void onOK() { +// add your code here + dispose(); + } + + public void close() { + dispose(); + } + + public static void main(String[] args) { + AlertWindow dialog = new AlertWindow("unused main() in alertwindow"); + dialog.pack(); + dialog.setVisible(true); + System.exit(0); + } + public static AlertWindow main(String s) { + AlertWindow dialog = new AlertWindow(s); + dialog.pack(); + dialog.setVisible(true); + System.exit(0); + return dialog; + } +} diff --git a/src/com/ixab/GUI/MainWindow.form b/src/com/ixab/GUI/MainWindow.form index e8f777a..f54ca40 100644 --- a/src/com/ixab/GUI/MainWindow.form +++ b/src/com/ixab/GUI/MainWindow.form @@ -71,7 +71,7 @@ - + @@ -90,7 +90,7 @@ - + @@ -102,24 +102,40 @@ - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/ixab/GUI/MainWindow.java b/src/com/ixab/GUI/MainWindow.java index 8a0e929..35eee71 100644 --- a/src/com/ixab/GUI/MainWindow.java +++ b/src/com/ixab/GUI/MainWindow.java @@ -32,6 +32,8 @@ public class MainWindow { private JLabel errorLabel; private JButton buttonReloadStreamData; + private JButton vorherigerButton; + private JButton nächsterButton; private boolean lockStreamInfoGetter = false; public MainWindow() { @@ -92,6 +94,26 @@ public class MainWindow { updateStreamDetails(); } }); + nächsterButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (comboBoxStreams.getSelectedIndex()!=ConfigFileInstanceHandler.getConfig().getStreams().size()-1) { + comboBoxStreams.setSelectedIndex(comboBoxStreams.getSelectedIndex() + 1); + } else { + comboBoxStreams.setSelectedIndex(0); + } + } + }); + vorherigerButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (comboBoxStreams.getSelectedIndex()!=0) { + comboBoxStreams.setSelectedIndex(comboBoxStreams.getSelectedIndex() - 1); + } else { + comboBoxStreams.setSelectedIndex(ConfigFileInstanceHandler.getConfig().getStreams().size()-1); + } + } + }); } private void startUpdaterThread() { if (updateThread != null) { @@ -178,7 +200,11 @@ public class MainWindow { ConfigFileInstanceHandler.getConfig().getStreams()) { comboBoxStreams.addItem(stream); } - comboBoxStreams.setSelectedItem(o); + if (o != null) { + comboBoxStreams.setSelectedItem(o); + } else { + comboBoxStreams.setSelectedIndex(0); + } } private void refreshQualityComboBox() { comboBoxQuality.removeAllItems(); diff --git a/src/com/ixab/Main.java b/src/com/ixab/Main.java index 6732f4a..9946599 100644 --- a/src/com/ixab/Main.java +++ b/src/com/ixab/Main.java @@ -3,12 +3,13 @@ package com.ixab; import com.ixab.ConfigHandling.Config; import com.ixab.ConfigHandling.ConfigFileIOHandler; import com.ixab.ConfigHandling.ConfigFileInstanceHandler; +import com.ixab.GUI.AlertWindow; import com.ixab.GUI.MainWindow; import javax.swing.*; public class Main { - private final static String version = "0.4 Alpha"; + private final static String version = "0.5 Alpha"; private static Config c = null; public static void main(String[] args) { try {