[ADDED] Nächster und Vorheriger Button

[ADDED] AlertWindow für später
This commit is contained in:
da
2015-11-30 21:09:29 +01:00
parent d2a61eb24d
commit da7301e374
5 changed files with 165 additions and 11 deletions
+64
View File
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.ixab.GUI.AlertWindow">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="48" y="54" width="436" height="297"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<hspacer id="98af6">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<grid id="9538f" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="OK"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="e3588" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="4c1c4" class="javax.swing.JLabel" binding="message">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Label"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>
+47
View File
@@ -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;
}
}
+25 -9
View File
@@ -71,7 +71,7 @@
<text value="Kategorie:"/> <text value="Kategorie:"/>
</properties> </properties>
</component> </component>
<grid id="31cd7" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="31cd7" layout-manager="GridLayoutManager" row-count="4" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -90,7 +90,7 @@
<grid id="8ebda" binding="panelPreviewImage" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="8ebda" binding="panelPreviewImage" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<grid row="0" column="1" row-span="3" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"> <grid row="0" column="1" row-span="4" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<minimum-size width="320" height="180"/> <minimum-size width="320" height="180"/>
<preferred-size width="320" height="180"/> <preferred-size width="320" height="180"/>
<maximum-size width="320" height="180"/> <maximum-size width="320" height="180"/>
@@ -102,24 +102,40 @@
<border type="none"/> <border type="none"/>
<children/> <children/>
</grid> </grid>
<hspacer id="8b583">
<constraints>
<grid row="0" column="2" row-span="2" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<vspacer id="edf84"> <vspacer id="edf84">
<constraints> <constraints>
<grid row="1" column="0" row-span="2" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> <grid row="2" column="0" row-span="2" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</vspacer> </vspacer>
<component id="8b335" class="javax.swing.JButton" binding="buttonReloadStreamData"> <component id="8b335" class="javax.swing.JButton" binding="buttonReloadStreamData">
<constraints> <constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <grid row="3" column="2" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<text value="Stream Daten neu laden"/> <text value="Stream Daten neu laden"/>
</properties> </properties>
</component> </component>
<vspacer id="f8cd8">
<constraints>
<grid row="2" column="2" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="1cf2f" class="javax.swing.JButton" binding="nächsterButton" default-binding="true">
<constraints>
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="nächster &gt;"/>
</properties>
</component>
<component id="a5ab7" class="javax.swing.JButton" binding="vorherigerButton" default-binding="true">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&lt; vorheriger"/>
</properties>
</component>
</children> </children>
</grid> </grid>
<component id="7fec7" class="javax.swing.JTextField" binding="textFieldStreamTitle"> <component id="7fec7" class="javax.swing.JTextField" binding="textFieldStreamTitle">
+27 -1
View File
@@ -32,6 +32,8 @@ public class MainWindow {
private JLabel errorLabel; private JLabel errorLabel;
private JButton buttonReloadStreamData; private JButton buttonReloadStreamData;
private JButton vorherigerButton;
private JButton nächsterButton;
private boolean lockStreamInfoGetter = false; private boolean lockStreamInfoGetter = false;
public MainWindow() { public MainWindow() {
@@ -92,6 +94,26 @@ public class MainWindow {
updateStreamDetails(); 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() { private void startUpdaterThread() {
if (updateThread != null) { if (updateThread != null) {
@@ -178,7 +200,11 @@ public class MainWindow {
ConfigFileInstanceHandler.getConfig().getStreams()) { ConfigFileInstanceHandler.getConfig().getStreams()) {
comboBoxStreams.addItem(stream); comboBoxStreams.addItem(stream);
} }
comboBoxStreams.setSelectedItem(o); if (o != null) {
comboBoxStreams.setSelectedItem(o);
} else {
comboBoxStreams.setSelectedIndex(0);
}
} }
private void refreshQualityComboBox() { private void refreshQualityComboBox() {
comboBoxQuality.removeAllItems(); comboBoxQuality.removeAllItems();
+2 -1
View File
@@ -3,12 +3,13 @@ package com.ixab;
import com.ixab.ConfigHandling.Config; import com.ixab.ConfigHandling.Config;
import com.ixab.ConfigHandling.ConfigFileIOHandler; import com.ixab.ConfigHandling.ConfigFileIOHandler;
import com.ixab.ConfigHandling.ConfigFileInstanceHandler; import com.ixab.ConfigHandling.ConfigFileInstanceHandler;
import com.ixab.GUI.AlertWindow;
import com.ixab.GUI.MainWindow; import com.ixab.GUI.MainWindow;
import javax.swing.*; import javax.swing.*;
public class Main { public class Main {
private final static String version = "0.4 Alpha"; private final static String version = "0.5 Alpha";
private static Config c = null; private static Config c = null;
public static void main(String[] args) { public static void main(String[] args) {
try { try {