-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
5,934 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.speedsouls.organizer.about; | ||
|
||
|
||
import java.awt.Cursor; | ||
import java.awt.Desktop; | ||
import java.awt.event.MouseAdapter; | ||
import java.awt.event.MouseEvent; | ||
import java.net.URI; | ||
|
||
import javax.swing.GroupLayout; | ||
import javax.swing.GroupLayout.Alignment; | ||
import javax.swing.JLabel; | ||
import javax.swing.JPanel; | ||
import javax.swing.SwingConstants; | ||
|
||
import com.speedsouls.organizer.data.OrganizerManager; | ||
|
||
|
||
/** | ||
* AboutPanel. | ||
* <p> | ||
* Panel containing information about the program. | ||
* | ||
* @author Kahmul (www.twitch.tv/kahmul78) | ||
* @date 5 Jun 2016 | ||
*/ | ||
public class AboutPanel extends JPanel | ||
{ | ||
|
||
private static final long serialVersionUID = 1295107948615705937L; | ||
|
||
|
||
/** | ||
* Creates a new AboutPanel. | ||
*/ | ||
protected AboutPanel() | ||
{ | ||
GroupLayout layout = new GroupLayout(this); | ||
layout.setAutoCreateGaps(true); | ||
layout.setAutoCreateContainerGaps(true); | ||
|
||
JLabel versionLabel = new JLabel("Version:"); | ||
JLabel versionNumberLabel = new JLabel(OrganizerManager.VERSION); | ||
|
||
JLabel developerLabel = new JLabel("Developed by:"); | ||
JLabel developerNameLabel = new JLabel("<html><body><a href=\"\">Kahmul78</a></body></html>"); | ||
developerNameLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); | ||
developerNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); | ||
developerNameLabel.addMouseListener(new MouseAdapter() { | ||
|
||
@Override | ||
public void mouseClicked(MouseEvent e) | ||
{ | ||
try | ||
{ | ||
Desktop.getDesktop().browse(new URI("www.twitter.com/Kahmul78")); | ||
} | ||
catch (Exception ex) | ||
{ | ||
} | ||
} | ||
}); | ||
|
||
// Horizontal | ||
GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup(); | ||
|
||
hGroup.addGroup(layout.createParallelGroup(Alignment.TRAILING).addComponent(versionLabel).addComponent(versionNumberLabel) | ||
.addComponent(developerLabel).addComponent(developerNameLabel)); | ||
|
||
layout.setHorizontalGroup(hGroup); | ||
|
||
// Vertical | ||
GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup(); | ||
|
||
vGroup.addComponent(versionLabel).addComponent(versionNumberLabel).addComponent(developerLabel).addComponent(developerNameLabel); | ||
|
||
layout.setVerticalGroup(vGroup); | ||
|
||
setLayout(layout); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.speedsouls.organizer.about; | ||
|
||
|
||
import java.awt.Dialog; | ||
import java.awt.FlowLayout; | ||
|
||
import javax.swing.BorderFactory; | ||
import javax.swing.ImageIcon; | ||
import javax.swing.JDialog; | ||
import javax.swing.JLabel; | ||
import javax.swing.JPanel; | ||
|
||
import com.speedsouls.organizer.data.OrganizerManager; | ||
|
||
|
||
/** | ||
* Short description. | ||
* <p> | ||
* Long description. | ||
* | ||
* @author Kahmul (www.twitch.tv/kahmul78) | ||
* @date 4 Jun 2016 | ||
*/ | ||
public class AboutWindow extends JDialog | ||
{ | ||
|
||
private static final long serialVersionUID = 3660600135211221410L; | ||
|
||
|
||
/** | ||
* Creates a new AboutWindow. | ||
*/ | ||
public AboutWindow() | ||
{ | ||
super(null, "About SpeedSouls - Save Organizer", Dialog.ModalityType.APPLICATION_MODAL); | ||
|
||
initProperties(); | ||
initLayout(); | ||
|
||
setVisible(true); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
private void initProperties() | ||
{ | ||
setIconImage(OrganizerManager.speedsoulsIcon); | ||
setSize(330, 140); | ||
setLocationRelativeTo(null); | ||
setResizable(false); | ||
setAlwaysOnTop(OrganizerManager.isAlwaysOnTop()); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
private void initLayout() | ||
{ | ||
JPanel guiPanel = new JPanel(); | ||
guiPanel.setLayout(new FlowLayout(FlowLayout.LEADING, 50, 0)); | ||
guiPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); | ||
|
||
guiPanel.add(new AboutPanel()); | ||
guiPanel.add(new JLabel(new ImageIcon(OrganizerManager.speedsoulsIconMedium))); | ||
|
||
add(guiPanel); | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
src/com/speedsouls/organizer/components/GamesComboBox.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.speedsouls.organizer.components; | ||
|
||
|
||
import java.awt.Component; | ||
import java.awt.event.ItemEvent; | ||
|
||
import javax.swing.DefaultListCellRenderer; | ||
import javax.swing.JComboBox; | ||
import javax.swing.JLabel; | ||
import javax.swing.JList; | ||
import javax.swing.ListCellRenderer; | ||
|
||
import com.speedsouls.organizer.content.Game; | ||
import com.speedsouls.organizer.data.OrganizerManager; | ||
|
||
|
||
/** | ||
* GamesComboBox. | ||
* <p> | ||
* ComboBox displaying Game objects. | ||
* | ||
* @author Kahmul (www.twitch.tv/kahmul78) | ||
* @date 29 Sep 2015 | ||
*/ | ||
public class GamesComboBox extends JComboBox<Game>implements ListCellRenderer<Game> | ||
{ | ||
|
||
private static final long serialVersionUID = -3428616630686103313L; | ||
|
||
|
||
/** | ||
* Creates a new GamesComboBox. | ||
* | ||
* @param games array of games to display in this combobox | ||
* @param profilesCB the associated ProfilesComboBox | ||
*/ | ||
public GamesComboBox(Game[] games, ProfilesComboBox profilesCB) | ||
{ | ||
fillWith(games); | ||
|
||
setRenderer(this); | ||
addItemListener(event -> { | ||
if (event.getStateChange() == ItemEvent.SELECTED) | ||
{ | ||
Game game = (Game) event.getItem(); | ||
OrganizerManager.switchToGame(game); | ||
profilesCB.setGame(game); | ||
} | ||
}); | ||
} | ||
|
||
|
||
/** | ||
* Fills the combobox with the given games. | ||
* | ||
* @param games the games to fill with | ||
*/ | ||
public void fillWith(Game[] games) | ||
{ | ||
if (games != null && games.length > 0) | ||
{ | ||
for (int i = 0; i < games.length; i++) | ||
{ | ||
addItem(games[i]); | ||
if (OrganizerManager.getSelectedGame() == games[i]) | ||
{ | ||
setSelectedItem(games[i]); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
@Override | ||
public Component getListCellRendererComponent(JList<? extends Game> list, Game game, int index, boolean isSelected, | ||
boolean cellHasFocus) | ||
{ | ||
JLabel label = (JLabel) new DefaultListCellRenderer().getListCellRendererComponent(list, game, index, isSelected, cellHasFocus); | ||
if (game != null) | ||
label.setText(game.getCaption()); | ||
return label; | ||
} | ||
|
||
} |
Oops, something went wrong.