This commit is contained in:
olivier 2018-02-18 14:39:30 +01:00
parent 0fa050d80e
commit c4d68f6b9d
2 changed files with 18 additions and 4 deletions

View file

@ -8,7 +8,11 @@ import java.awt.event.*;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
public class RecordDialog extends LlanfairDialog /**
* Dialog window to select a world record on speedrun.com
* @author 4ilo 2018
*/
public class RecordDialog extends JDialog
{ {
private JLabel searchLabel = new JLabel("Search game:"); private JLabel searchLabel = new JLabel("Search game:");
private JButton searchButton = new JButton("Search"); private JButton searchButton = new JButton("Search");
@ -24,7 +28,7 @@ public class RecordDialog extends LlanfairDialog
private JButton close = new JButton("Close"); private JButton close = new JButton("Close");
private JButton ok = new JButton("Ok"); private JButton ok = new JButton("Ok");
private JLabel worldRecord = new JLabel(); private JLabel worldRecord = new JLabel("Unknown World Record");
private ActionListener categoryListener; private ActionListener categoryListener;
private ActionListener gameListener; private ActionListener gameListener;
@ -264,6 +268,16 @@ public class RecordDialog extends LlanfairDialog
"Error", JOptionPane.ERROR_MESSAGE); "Error", JOptionPane.ERROR_MESSAGE);
} }
/**
* Show the dialog
*/
public void display()
{
setAlwaysOnTop(true);
setModalityType(ModalityType.APPLICATION_MODAL);
pack();
setVisible(true);
}
/** /**
* Get the selected category object * Get the selected category object

View file

@ -175,7 +175,7 @@ implements ActionListener, ListSelectionListener {
selectRecord = new JButton("Select record"); selectRecord = new JButton("Select record");
recordCategory = run.getRecordCategory(); recordCategory = run.getRecordCategory();
if(recordCategory.getId().equals("")) { if(!recordCategory.getId().equals("")) {
try { try {
recordString = new JLabel(WorldRecordParser.getRecord(recordCategory)); recordString = new JLabel(WorldRecordParser.getRecord(recordCategory));
} catch(Exception e) { } catch(Exception e) {
@ -352,7 +352,7 @@ implements ActionListener, ListSelectionListener {
segments.setRowSelectionInterval(selected + 1, selected + 1); segments.setRowSelectionInterval(selected + 1, selected + 1);
} else if (source.equals(selectRecord)) { } else if (source.equals(selectRecord)) {
recordSelector = new RecordDialog(this); recordSelector = new RecordDialog(this);
recordSelector.display(false, null); recordSelector.display();
} }
} }