Created
November 28, 2015 01:19
-
-
Save LucasAlfare/3ff5b47f6a2c836204fd to your computer and use it in GitHub Desktop.
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
package HueTimer.auxiliares; | |
import javax.swing.*; | |
import java.util.TimerTask; | |
/** | |
* Created by lucas on 31/10/15. | |
*/ | |
public class Chronometer extends TimerTask { | |
private JLabel targetLabel; | |
private long i = System.currentTimeMillis(); | |
public static long e; | |
public Chronometer(JLabel targetLabel){ | |
this.targetLabel = targetLabel; | |
} | |
public long getElapsedTimeValue(){ | |
e = System.currentTimeMillis() - i; | |
return e; | |
} | |
public String getFormattedElapsedTimeValue(){ | |
return TimeFormater.getTimeFormated(getElapsedTimeValue()); | |
} | |
@Override | |
public void run() { | |
targetLabel.setText(this.getFormattedElapsedTimeValue()); | |
} | |
} |
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
package HueTimer.auxiliares; | |
import javax.swing.*; | |
import java.awt.*; | |
import java.util.TimerTask; | |
/** | |
* Created by lucas on 31/10/15. | |
*/ | |
public class Inspection extends TimerTask{ | |
private JLabel targetLabel; | |
private byte countdown = 15; | |
public Inspection(JLabel targetLabel){ | |
this.targetLabel = targetLabel; | |
} | |
private byte getElapsedCountdown(){ | |
return countdown > 0 ? countdown-- : 0; | |
} | |
@Override | |
public String toString() { | |
return this.getElapsedCountdown() + ""; | |
} | |
@Override | |
public void run() { | |
targetLabel.setForeground(Color.YELLOW); | |
targetLabel.setText(this.toString()); | |
} | |
} |
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
package HueTimer.modelos; | |
/** | |
* Created by lucas on 26/11/15. | |
*/ | |
public interface ListingSolvesModel { | |
void setSolveOnList(); | |
} |
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
package HueTimer.provedores; | |
import HueTimer.modelos.ListingSolvesModel; | |
import HueTimer.modelos.Solve; | |
import javax.swing.*; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
import java.util.ArrayList; | |
/** | |
* Created by lucas on 26/11/15. | |
*/ | |
public class ListingSolvesProvider implements ListingSolvesModel, KeyListener { | |
private DefaultListModel<String> targetDefaultListModel; | |
private ArrayList<Solve> solves; | |
public ListingSolvesProvider(DefaultListModel<String> targetDefaultListModel, ArrayList<Solve> solves){ | |
this.targetDefaultListModel = targetDefaultListModel; | |
this.solves = solves; | |
} | |
@Override | |
public void setSolveOnList() { | |
targetDefaultListModel.add(0, solves.get(solves.size() - 1).toString()); | |
} | |
@Override | |
public void keyReleased(KeyEvent e) { | |
if (e.getKeyCode() == 32){ | |
if (TimerProvider.podeSalvarSolve()){ | |
this.setSolveOnList(); | |
} | |
} | |
} | |
@Override | |
public void keyTyped(KeyEvent e) {} | |
@Override | |
public void keyPressed(KeyEvent e) {} | |
} |
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
package HueTimer.principal; | |
import HueTimer.auxiliares.ScramblesConstants; | |
import HueTimer.modelos.Solve; | |
import HueTimer.provedores.ListingSolvesProvider; | |
import HueTimer.provedores.SavingInternalProvider; | |
import HueTimer.provedores.ScrambleProvider; | |
import HueTimer.provedores.TimerProvider; | |
import javax.swing.*; | |
import java.awt.*; | |
import java.util.ArrayList; | |
/** | |
* Created by lucas on 12/11/15. | |
*/ | |
public class MainTest extends JFrame { | |
private JPanel timerPanel; | |
private GridLayout gridLayout; | |
private JLabel timerLabel, scrambleLabel; | |
private ArrayList<Solve> solves; | |
private TimerProvider timerStarter; | |
private ScrambleProvider scrambleProvider; | |
private ListingSolvesProvider listingSolvesProvider; | |
private SavingInternalProvider savingInternalProvider; | |
private JCheckBox checkBox; | |
private DefaultListModel defaultListModel; | |
private JList jList; | |
public MainTest() { | |
this.setSize(800, 300); | |
this.setDefaultCloseOperation(3); | |
this.setLocationRelativeTo(null); | |
init(); | |
this.add(timerPanel); | |
timerStarter = new TimerProvider(timerLabel, checkBox); | |
this.addKeyListener(timerStarter); | |
scrambleProvider = new ScrambleProvider(scrambleLabel, ScramblesConstants.RUBIKS_CUBE); | |
this.addKeyListener(scrambleProvider); | |
savingInternalProvider = new SavingInternalProvider(solves); | |
this.addKeyListener(savingInternalProvider); | |
listingSolvesProvider = new ListingSolvesProvider(defaultListModel, solves); | |
this.addKeyListener(listingSolvesProvider); | |
setMenuEvents(); | |
} | |
public void init() { | |
gridLayout = new GridLayout(3, 1); | |
timerPanel = new JPanel(); | |
timerPanel.setBackground(Color.BLACK); | |
timerLabel = new JLabel("00:00.00"); | |
timerLabel.setFont(new Font("Dialog", Font.BOLD, 25)); | |
timerLabel.setForeground(Color.WHITE); | |
scrambleLabel = new JLabel("loading..."); | |
scrambleLabel.setForeground(Color.WHITE); | |
checkBox = new JCheckBox("use inspection"); | |
checkBox.setBackground(Color.BLACK); | |
checkBox.setForeground(Color.WHITE); | |
checkBox.setFocusable(false); | |
defaultListModel = new DefaultListModel(); | |
jList = new JList(defaultListModel); | |
jList.setFocusable(false); | |
timerPanel.setLayout(gridLayout); | |
solves = new ArrayList<>(); | |
timerPanel.add(scrambleLabel); | |
timerPanel.add(timerLabel); | |
timerPanel.add(checkBox); | |
timerPanel.add(jList); | |
} | |
public void setMenuEvents() { | |
JMenuBar barra = new JMenuBar(); | |
setJMenuBar(barra); | |
JMenu arquivo = new JMenu("Arquivo"); | |
JMenu scramble = new JMenu("Scramble"); | |
JMenuItem fechar = new JMenuItem("Fechar"); | |
arquivo.add(fechar); | |
fechar.addActionListener(e -> System.exit(0)); | |
JMenuItem rubiks = new JMenuItem("3x3"); | |
scramble.add(rubiks); | |
rubiks.addActionListener(e -> { | |
removeKeyListener(scrambleProvider); | |
scrambleProvider = new ScrambleProvider(scrambleLabel, ScramblesConstants.RUBIKS_CUBE); | |
addKeyListener(scrambleProvider); | |
}); | |
JMenuItem pocket = new JMenuItem("2x2"); | |
scramble.add(pocket); | |
pocket.addActionListener(e -> { | |
removeKeyListener(scrambleProvider); | |
scrambleProvider = new ScrambleProvider(scrambleLabel, ScramblesConstants.POCKET_CUBE); | |
addKeyListener(scrambleProvider); | |
}); | |
JMenuItem square = new JMenuItem("Square-1"); | |
scramble.add(square); | |
square.addActionListener(e -> { | |
removeKeyListener(scrambleProvider); | |
scrambleProvider = new ScrambleProvider(scrambleLabel, ScramblesConstants.SQUARE); | |
addKeyListener(scrambleProvider); | |
}); | |
JMenuItem skewb = new JMenuItem("Skewb"); | |
scramble.add(skewb); | |
skewb.addActionListener(e -> { | |
removeKeyListener(scrambleProvider); | |
scrambleProvider = new ScrambleProvider(scrambleLabel, ScramblesConstants.SKEWB); | |
addKeyListener(scrambleProvider); | |
}); | |
JMenuItem megaminx = new JMenuItem("Megaminx"); | |
scramble.add(megaminx); | |
megaminx.addActionListener(e -> { | |
removeKeyListener(scrambleProvider); | |
scrambleProvider = new ScrambleProvider(scrambleLabel, ScramblesConstants.MEGAMINX); | |
addKeyListener(scrambleProvider); | |
}); | |
JMenuItem clock = new JMenuItem("Clock"); | |
scramble.add(clock); | |
clock.addActionListener(e -> { | |
removeKeyListener(scrambleProvider); | |
scrambleProvider = new ScrambleProvider(scrambleLabel, ScramblesConstants.CLOCK); | |
addKeyListener(scrambleProvider); | |
}); | |
barra.add(arquivo); | |
barra.add(scramble); | |
} | |
//public static void main(String[] args) { | |
// new MainTest().setVisible(true); | |
//} | |
} |
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
package HueTimer.principal; | |
import HueTimer.auxiliares.ScramblesConstants; | |
import HueTimer.modelos.Solve; | |
import HueTimer.provedores.ListingSolvesProvider; | |
import HueTimer.provedores.SavingInternalProvider; | |
import HueTimer.provedores.ScrambleProvider; | |
import HueTimer.provedores.TimerProvider; | |
import javax.swing.*; | |
import java.util.ArrayList; | |
/** | |
* Created by lucas on 27/11/15. | |
*/ | |
public class NewMainTest extends javax.swing.JFrame { | |
private ArrayList<Solve> solves; | |
private TimerProvider timerStarter; | |
private ScrambleProvider scrambleProvider; | |
private ListingSolvesProvider listingSolvesProvider; | |
private SavingInternalProvider savingInternalProvider; | |
private DefaultListModel<String> defaultListModel; | |
public NewMainTest() { | |
initComponents(); | |
solves = new ArrayList<>(); | |
timerStarter = new TimerProvider(cronoView, enableInspection); | |
this.addKeyListener(timerStarter); | |
scrambleProvider = new ScrambleProvider(scrambleView, ScramblesConstants.POCKET_CUBE); | |
this.addKeyListener(scrambleProvider); | |
savingInternalProvider = new SavingInternalProvider(solves); | |
this.addKeyListener(savingInternalProvider); | |
listingSolvesProvider = new ListingSolvesProvider(defaultListModel, solves); | |
this.addKeyListener(listingSolvesProvider); | |
} | |
private void initComponents() { | |
jPanel1 = new javax.swing.JPanel(); | |
jTabbedPane1 = new javax.swing.JTabbedPane(); | |
jPanel3 = new javax.swing.JPanel(); | |
jPanel2 = new javax.swing.JPanel(); | |
scrambleView = new javax.swing.JLabel(); | |
cronoView = new javax.swing.JLabel(); | |
jPanel5 = new javax.swing.JPanel(); | |
jLabel2 = new javax.swing.JLabel(); | |
jLabel3 = new javax.swing.JLabel(); | |
enableInspection = new javax.swing.JCheckBox(); | |
jLabel5 = new javax.swing.JLabel(); | |
jPanel4 = new javax.swing.JPanel(); | |
jPanel6 = new javax.swing.JPanel(); | |
jButton1 = new javax.swing.JButton(); | |
jButton2 = new javax.swing.JButton(); | |
jPanel15 = new javax.swing.JPanel(); | |
jButton19 = new javax.swing.JButton(); | |
jButton20 = new javax.swing.JButton(); | |
jPanel16 = new javax.swing.JPanel(); | |
jButton21 = new javax.swing.JButton(); | |
jButton22 = new javax.swing.JButton(); | |
jPanel17 = new javax.swing.JPanel(); | |
jButton23 = new javax.swing.JButton(); | |
jButton24 = new javax.swing.JButton(); | |
jPanel18 = new javax.swing.JPanel(); | |
jButton25 = new javax.swing.JButton(); | |
jButton26 = new javax.swing.JButton(); | |
jPanel7 = new javax.swing.JPanel(); | |
jScrollPane1 = new javax.swing.JScrollPane(); | |
jList1 = new javax.swing.JList(); | |
jMenuBar1 = new javax.swing.JMenuBar(); | |
jMenu1 = new javax.swing.JMenu(); | |
jMenuItem1 = new javax.swing.JMenuItem(); | |
jMenu2 = new javax.swing.JMenu(); | |
jMenuItem2 = new javax.swing.JMenuItem(); | |
jMenuItem3 = new javax.swing.JMenuItem(); | |
jSeparator1 = new javax.swing.JPopupMenu.Separator(); | |
jMenuItem4 = new javax.swing.JMenuItem(); | |
jMenuItem9 = new javax.swing.JMenuItem(); | |
jSeparator2 = new javax.swing.JPopupMenu.Separator(); | |
jMenuItem5 = new javax.swing.JMenuItem(); | |
jMenuItem6 = new javax.swing.JMenuItem(); | |
jMenuItem7 = new javax.swing.JMenuItem(); | |
jMenu3 = new javax.swing.JMenu(); | |
jMenuItem8 = new javax.swing.JMenuItem(); | |
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | |
setTitle("HueTimer"); | |
setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel1.setBackground(new java.awt.Color(0, 0, 0)); | |
jTabbedPane1.setBackground(new java.awt.Color(0, 0, 0)); | |
jTabbedPane1.setFocusable(false); | |
jPanel3.setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel2.setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Embaralhamento", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(204, 204, 204))); // NOI18N | |
jPanel2.setAutoscrolls(true); | |
jPanel2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); | |
jPanel2.setFocusable(false); | |
scrambleView.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N | |
scrambleView.setForeground(new java.awt.Color(255, 255, 255)); | |
scrambleView.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
scrambleView.setFocusable(false); | |
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); | |
jPanel2.setLayout(jPanel2Layout); | |
jPanel2Layout.setHorizontalGroup( | |
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel2Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(scrambleView, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addContainerGap()) | |
); | |
jPanel2Layout.setVerticalGroup( | |
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel2Layout.createSequentialGroup() | |
.addComponent(scrambleView, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE) | |
.addContainerGap()) | |
); | |
cronoView.setFont(new java.awt.Font("Impact", 3, 70)); // NOI18N | |
cronoView.setForeground(new java.awt.Color(255, 255, 255)); | |
cronoView.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
cronoView.setText("00:00.00"); | |
cronoView.setFocusable(false); | |
jPanel5.setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Últimas médias", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(204, 204, 204))); // NOI18N | |
jPanel5.setFocusable(false); | |
jLabel2.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N | |
jLabel2.setForeground(new java.awt.Color(255, 255, 255)); | |
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
jLabel2.setText("ao5: - -"); | |
jLabel2.setFocusable(false); | |
jLabel3.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N | |
jLabel3.setForeground(new java.awt.Color(255, 255, 255)); | |
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
jLabel3.setText("ao12: - -"); | |
jLabel3.setFocusable(false); | |
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); | |
jPanel5.setLayout(jPanel5Layout); | |
jPanel5Layout.setHorizontalGroup( | |
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel5Layout.createSequentialGroup() | |
.addContainerGap() | |
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)) | |
.addContainerGap()) | |
); | |
jPanel5Layout.setVerticalGroup( | |
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel5Layout.createSequentialGroup() | |
.addComponent(jLabel2) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(jLabel3) | |
.addContainerGap()) | |
); | |
enableInspection.setBackground(new java.awt.Color(0, 0, 0)); | |
enableInspection.setForeground(new java.awt.Color(255, 255, 255)); | |
enableInspection.setText("Usar Inspeção"); | |
enableInspection.setFocusable(false); | |
enableInspection.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
jLabel5.setForeground(new java.awt.Color(255, 255, 255)); | |
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
jLabel5.setText("Solves: - -"); | |
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); | |
jPanel3.setLayout(jPanel3Layout); | |
jPanel3Layout.setHorizontalGroup( | |
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel3Layout.createSequentialGroup() | |
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel3Layout.createSequentialGroup() | |
.addGap(181, 181, 181) | |
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 106, Short.MAX_VALUE) | |
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
.addGroup(jPanel3Layout.createSequentialGroup() | |
.addContainerGap() | |
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addComponent(enableInspection, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addComponent(cronoView, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) | |
.addContainerGap()) | |
); | |
jPanel3Layout.setVerticalGroup( | |
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel3Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(18, 18, 18) | |
.addComponent(cronoView, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(enableInspection) | |
.addGap(7, 7, 7) | |
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addComponent(jLabel5)) | |
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
); | |
jTabbedPane1.addTab("Principal", jPanel3); | |
jPanel4.setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel6.setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tempos Únicos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(204, 204, 204))); // NOI18N | |
jPanel6.setFocusable(false); | |
jButton1.setText("melhor: - -"); | |
jButton1.setFocusable(false); | |
jButton2.setText("pior: - -"); | |
jButton2.setFocusable(false); | |
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); | |
jPanel6.setLayout(jPanel6Layout); | |
jPanel6Layout.setHorizontalGroup( | |
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel6Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addContainerGap()) | |
); | |
jPanel6Layout.setVerticalGroup( | |
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() | |
.addContainerGap() | |
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE) | |
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
.addContainerGap()) | |
); | |
jPanel15.setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Médias de 12 tempos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(204, 204, 204))); // NOI18N | |
jPanel15.setFocusable(false); | |
jButton19.setText("melhor: - -"); | |
jButton19.setFocusable(false); | |
jButton20.setText("pior: - -"); | |
jButton20.setFocusable(false); | |
javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15); | |
jPanel15.setLayout(jPanel15Layout); | |
jPanel15Layout.setHorizontalGroup( | |
jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel15Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jButton19, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(jButton20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addContainerGap()) | |
); | |
jPanel15Layout.setVerticalGroup( | |
jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel15Layout.createSequentialGroup() | |
.addContainerGap() | |
.addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
.addComponent(jButton20, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE) | |
.addComponent(jButton19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
.addContainerGap()) | |
); | |
jPanel16.setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Médias de 5 tempos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(204, 204, 204))); // NOI18N | |
jPanel16.setFocusable(false); | |
jButton21.setText("melhor: - -"); | |
jButton21.setFocusable(false); | |
jButton22.setText("pior: - -"); | |
jButton22.setFocusable(false); | |
javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16); | |
jPanel16.setLayout(jPanel16Layout); | |
jPanel16Layout.setHorizontalGroup( | |
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel16Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jButton21, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(jButton22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addContainerGap()) | |
); | |
jPanel16Layout.setVerticalGroup( | |
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup() | |
.addContainerGap() | |
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
.addComponent(jButton22, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE) | |
.addComponent(jButton21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
.addContainerGap()) | |
); | |
jPanel17.setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Médias de 100 tempos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(204, 204, 204))); // NOI18N | |
jPanel17.setFocusable(false); | |
jButton23.setText("melhor: - -"); | |
jButton23.setFocusable(false); | |
jButton24.setText("pior: - -"); | |
jButton24.setFocusable(false); | |
javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17); | |
jPanel17.setLayout(jPanel17Layout); | |
jPanel17Layout.setHorizontalGroup( | |
jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel17Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jButton23, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(jButton24, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE) | |
.addContainerGap()) | |
); | |
jPanel17Layout.setVerticalGroup( | |
jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel17Layout.createSequentialGroup() | |
.addContainerGap() | |
.addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
.addComponent(jButton24, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE) | |
.addComponent(jButton23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
.addContainerGap()) | |
); | |
jPanel18.setBackground(new java.awt.Color(0, 0, 0)); | |
jPanel18.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Médias de 50 tempos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(204, 204, 204))); // NOI18N | |
jPanel18.setFocusable(false); | |
jButton25.setText("melhor: - -"); | |
jButton25.setFocusable(false); | |
jButton26.setText("pior: - -"); | |
jButton26.setFocusable(false); | |
javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18); | |
jPanel18.setLayout(jPanel18Layout); | |
jPanel18Layout.setHorizontalGroup( | |
jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel18Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jButton25, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(jButton26, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE) | |
.addContainerGap()) | |
); | |
jPanel18Layout.setVerticalGroup( | |
jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel18Layout.createSequentialGroup() | |
.addContainerGap() | |
.addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
.addComponent(jButton26, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE) | |
.addComponent(jButton25, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
.addContainerGap()) | |
); | |
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); | |
jPanel4.setLayout(jPanel4Layout); | |
jPanel4Layout.setHorizontalGroup( | |
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel4Layout.createSequentialGroup() | |
.addContainerGap() | |
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addComponent(jPanel15, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addComponent(jPanel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() | |
.addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) | |
.addContainerGap()) | |
); | |
jPanel4Layout.setVerticalGroup( | |
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel4Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(11, 11, 11) | |
.addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
.addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
); | |
jTabbedPane1.addTab("Estatísticas", jPanel4); | |
jPanel7.setBackground(new java.awt.Color(0, 0, 0)); | |
jList1.setBackground(new java.awt.Color(0, 0, 0)); | |
jList1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N | |
jList1.setForeground(new java.awt.Color(255, 255, 255)); | |
jList1.setFocusable(false); | |
defaultListModel = new DefaultListModel<>(); | |
if (solves != null){ | |
defaultListModel.add(0, solves.get(solves.size()).toString()); | |
} | |
jList1.setModel(defaultListModel); | |
jScrollPane1.setViewportView(jList1); | |
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); | |
jPanel7.setLayout(jPanel7Layout); | |
jPanel7Layout.setHorizontalGroup( | |
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel7Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 656, Short.MAX_VALUE) | |
.addContainerGap()) | |
); | |
jPanel7Layout.setVerticalGroup( | |
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel7Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE) | |
.addContainerGap()) | |
); | |
jTabbedPane1.addTab("Lista dos Tempos", jPanel7); | |
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); | |
jPanel1.setLayout(jPanel1Layout); | |
jPanel1Layout.setHorizontalGroup( | |
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel1Layout.createSequentialGroup() | |
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(0, 0, Short.MAX_VALUE)) | |
); | |
jPanel1Layout.setVerticalGroup( | |
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addComponent(jTabbedPane1) | |
); | |
jTabbedPane1.getAccessibleContext().setAccessibleName("Principal"); | |
jMenuBar1.setFocusable(false); | |
jMenu1.setText("Arquivo"); | |
jMenu1.setFocusable(false); | |
jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0)); | |
jMenuItem1.setText("Sair"); | |
jMenu1.add(jMenuItem1); | |
jMenuBar1.add(jMenu1); | |
jMenu2.setText("Scramble"); | |
jMenu2.setFocusable(false); | |
jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_2, java.awt.event.InputEvent.CTRL_MASK)); | |
jMenuItem2.setText("2x2"); | |
jMenu2.add(jMenuItem2); | |
jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_3, java.awt.event.InputEvent.CTRL_MASK)); | |
jMenuItem3.setText("3x3"); | |
jMenu2.add(jMenuItem3); | |
jMenu2.add(jSeparator1); | |
jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_1, java.awt.event.InputEvent.CTRL_MASK)); | |
jMenuItem4.setText("Square-1"); | |
jMenu2.add(jMenuItem4); | |
jMenuItem9.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_1, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); | |
jMenuItem9.setText("Square-1 Cúbico"); | |
jMenu2.add(jMenuItem9); | |
jMenu2.add(jSeparator2); | |
jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); | |
jMenuItem5.setText("Skewb"); | |
jMenu2.add(jMenuItem5); | |
jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK)); | |
jMenuItem6.setText("Clock"); | |
jMenu2.add(jMenuItem6); | |
jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.CTRL_MASK)); | |
jMenuItem7.setText("Megaminx"); | |
jMenu2.add(jMenuItem7); | |
jMenuBar1.add(jMenu2); | |
jMenu3.setText("Estatísticas"); | |
jMenuItem8.setText("Detalhamento da sessão"); | |
jMenu3.add(jMenuItem8); | |
jMenuBar1.add(jMenu3); | |
setJMenuBar(jMenuBar1); | |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
getContentPane().setLayout(layout); | |
layout.setHorizontalGroup( | |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
); | |
layout.setVerticalGroup( | |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
); | |
pack(); | |
}// </editor-fold> | |
/** | |
* @param args the command line arguments | |
*/ | |
public static void main(String args[]) { | |
/* Set the Nimbus look and feel */ | |
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> | |
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. | |
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html | |
*/ | |
try { | |
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { | |
if ("Windows".equals(info.getName())) { | |
javax.swing.UIManager.setLookAndFeel(info.getClassName()); | |
break; | |
} | |
} | |
} catch (ClassNotFoundException ex) { | |
java.util.logging.Logger.getLogger(MainTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} catch (InstantiationException ex) { | |
java.util.logging.Logger.getLogger(MainTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} catch (IllegalAccessException ex) { | |
java.util.logging.Logger.getLogger(MainTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} catch (javax.swing.UnsupportedLookAndFeelException ex) { | |
java.util.logging.Logger.getLogger(MainTest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} | |
//</editor-fold> | |
/* Create and display the form */ | |
java.awt.EventQueue.invokeLater(() -> new NewMainTest().setVisible(true)); | |
} | |
// Variables declaration - do not modify | |
private javax.swing.JButton jButton1; | |
private javax.swing.JButton jButton10; | |
private javax.swing.JButton jButton11; | |
private javax.swing.JButton jButton12; | |
private javax.swing.JButton jButton13; | |
private javax.swing.JButton jButton14; | |
private javax.swing.JButton jButton15; | |
private javax.swing.JButton jButton16; | |
private javax.swing.JButton jButton17; | |
private javax.swing.JButton jButton18; | |
private javax.swing.JButton jButton19; | |
private javax.swing.JButton jButton2; | |
private javax.swing.JButton jButton20; | |
private javax.swing.JButton jButton21; | |
private javax.swing.JButton jButton22; | |
private javax.swing.JButton jButton23; | |
private javax.swing.JButton jButton24; | |
private javax.swing.JButton jButton25; | |
private javax.swing.JButton jButton26; | |
private javax.swing.JButton jButton5; | |
private javax.swing.JButton jButton6; | |
private javax.swing.JButton jButton7; | |
private javax.swing.JButton jButton8; | |
private javax.swing.JButton jButton9; | |
private javax.swing.JCheckBox enableInspection; | |
private javax.swing.JLabel cronoView; | |
private javax.swing.JLabel jLabel2; | |
private javax.swing.JLabel jLabel3; | |
private javax.swing.JLabel scrambleView; | |
private javax.swing.JLabel jLabel5; | |
private javax.swing.JList jList1; | |
private javax.swing.JMenu jMenu1; | |
private javax.swing.JMenu jMenu2; | |
private javax.swing.JMenu jMenu3; | |
private javax.swing.JMenuBar jMenuBar1; | |
private javax.swing.JMenuItem jMenuItem1; | |
private javax.swing.JMenuItem jMenuItem2; | |
private javax.swing.JMenuItem jMenuItem3; | |
private javax.swing.JMenuItem jMenuItem4; | |
private javax.swing.JMenuItem jMenuItem5; | |
private javax.swing.JMenuItem jMenuItem6; | |
private javax.swing.JMenuItem jMenuItem7; | |
private javax.swing.JMenuItem jMenuItem8; | |
private javax.swing.JMenuItem jMenuItem9; | |
private javax.swing.JPanel jPanel1; | |
private javax.swing.JPanel jPanel10; | |
private javax.swing.JPanel jPanel11; | |
private javax.swing.JPanel jPanel12; | |
private javax.swing.JPanel jPanel13; | |
private javax.swing.JPanel jPanel14; | |
private javax.swing.JPanel jPanel15; | |
private javax.swing.JPanel jPanel16; | |
private javax.swing.JPanel jPanel17; | |
private javax.swing.JPanel jPanel18; | |
private javax.swing.JPanel jPanel2; | |
private javax.swing.JPanel jPanel3; | |
private javax.swing.JPanel jPanel4; | |
private javax.swing.JPanel jPanel5; | |
private javax.swing.JPanel jPanel6; | |
private javax.swing.JPanel jPanel7; | |
private javax.swing.JPanel jPanel8; | |
private javax.swing.JPanel jPanel9; | |
private javax.swing.JScrollPane jScrollPane1; | |
private javax.swing.JPopupMenu.Separator jSeparator1; | |
private javax.swing.JPopupMenu.Separator jSeparator2; | |
private javax.swing.JTabbedPane jTabbedPane1; | |
// End of variables declaration | |
} |
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
package HueTimer.embaralhadores; | |
import HueTimer.modelos.Scrambler; | |
/** | |
* Created by lucas on 31/10/15. | |
*/ | |
public class PocketCube implements Scrambler { | |
private String[] moves = {"R", "U", "F"}; | |
private String[] directs = {" ", "' ", "2 "}; | |
@Override | |
public String getSequence() { | |
String fullSequence= ""; | |
String prev = ""; | |
String curr = ""; | |
for (int i = 0; i < 12; i++){ | |
do { | |
curr = moves[RANDOM.nextInt(moves.length)]; | |
} while (curr.equals(prev)); | |
fullSequence += curr + directs[RANDOM.nextInt(directs.length)]; | |
prev = curr; | |
} | |
return fullSequence; | |
} | |
} |
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
package HueTimer.embaralhadores; | |
import HueTimer.modelos.Scrambler; | |
/** | |
* Created by lucas on 12/11/15. | |
*/ | |
public class RubiksCube implements Scrambler{ | |
String[] moves = { "R1", "L1", "U2", "D2", "F3", "B3" }; | |
String[] sentidos = { " ", "' ", "2 " }; | |
@Override | |
public String getSequence() { | |
String scramble = ""; | |
String sentido = ""; | |
String m1 = ""; | |
String m2 = ""; | |
String m3 = ""; | |
m1 = moves[RANDOM.nextInt(moves.length)]; | |
do { | |
m2 = moves[RANDOM.nextInt(moves.length)]; | |
} while (m2 == m1); | |
for (int i = 0; i < 25; i++) { | |
do { | |
m3 = moves[RANDOM.nextInt(moves.length)]; | |
} while (m3 == m2 || m3.charAt(1) == m2.charAt(1) && m3.charAt(1) == m1.charAt(1)); | |
sentido = sentidos[RANDOM.nextInt(sentidos.length)]; | |
scramble += m3.charAt(0) + sentido; | |
m1 = m2; | |
m2 = m3; | |
} | |
return scramble; | |
} | |
} |
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
package HueTimer.modelos; | |
/** | |
* Created by lucas on 26/11/15. | |
*/ | |
public interface SavingInternalModel { | |
void saveSolve(); | |
Solve getSolve(); | |
} |
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
package HueTimer.provedores; | |
import HueTimer.auxiliares.Chronometer; | |
import HueTimer.modelos.SavingInternalModel; | |
import HueTimer.modelos.Solve; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
import java.util.ArrayList; | |
/** | |
* Created by lucas on 26/11/15. | |
*/ | |
public class SavingInternalProvider implements SavingInternalModel, KeyListener { | |
private ArrayList<Solve> solves; | |
public SavingInternalProvider(ArrayList<Solve> solves){ | |
this.solves = solves; | |
} | |
@Override | |
public void saveSolve() { | |
solves.add(this.getSolve()); | |
} | |
@Override | |
public Solve getSolve() { | |
return new Solve(solves.size() + 1, Chronometer.e, ScrambleProvider.scrambleAnterior); | |
} | |
@Override | |
public void keyTyped(KeyEvent e) { | |
} | |
@Override | |
public void keyPressed(KeyEvent e) { | |
} | |
@Override | |
public void keyReleased(KeyEvent e) { | |
if (e.getKeyCode() == 32){ | |
if (TimerProvider.podeSalvarSolve()){ | |
this.saveSolve(); | |
} | |
} | |
} | |
} |
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
package HueTimer.modelos; | |
/** | |
* Created by lucas on 12/11/15. | |
*/ | |
public interface ScrambleModel { | |
void setPrevScramble(); | |
void setScramble(); | |
} |
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
package HueTimer.provedores; | |
import HueTimer.auxiliares.ScramblesConstants; | |
import HueTimer.embaralhadores.PocketCube; | |
import HueTimer.embaralhadores.RubiksCube; | |
import HueTimer.embaralhadores.SquareOne; | |
import HueTimer.modelos.ScrambleModel; | |
import javax.swing.*; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
/** | |
* Created by lucas on 12/11/15. | |
*/ | |
public class ScrambleProvider implements ScrambleModel, KeyListener { | |
private JLabel targetLabel; | |
private int scrambleType; | |
public static String scrambleAtual; | |
public static String scrambleAnterior; | |
public ScrambleProvider(JLabel targetLabel, int scrambleType){ | |
this.targetLabel = targetLabel; | |
this.scrambleType = scrambleType; | |
this.setScramble(); | |
} | |
@Override | |
public void setPrevScramble() { | |
scrambleAnterior = scrambleAtual; | |
} | |
@Override | |
public void setScramble() { | |
switch (scrambleType){ | |
case ScramblesConstants.RUBIKS_CUBE: | |
scrambleAtual = new RubiksCube().getSequence(); | |
targetLabel.setText(scrambleAtual); | |
break; | |
case ScramblesConstants.POCKET_CUBE: | |
scrambleAtual = new PocketCube().getSequence(); | |
targetLabel.setText(scrambleAtual); | |
break; | |
case ScramblesConstants.SKEWB: | |
scrambleAtual = "kkkk.."; | |
targetLabel.setText(scrambleAtual); | |
break; | |
case ScramblesConstants.SQUARE: | |
scrambleAtual = new SquareOne().getSequence(); | |
targetLabel.setText(scrambleAtual); | |
} | |
} | |
@Override | |
public void keyTyped(KeyEvent e) { | |
} | |
@Override | |
public void keyPressed(KeyEvent e) { | |
if (e.getKeyCode() == KeyEvent.VK_SPACE){ | |
this.setPrevScramble(); | |
} | |
} | |
@Override | |
public void keyReleased(KeyEvent e) { | |
if (e.getKeyCode() == KeyEvent.VK_SPACE){ | |
if (TimerProvider.podeMudarScramble()){ | |
this.setScramble(); | |
} | |
} | |
} | |
} |
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
package HueTimer.modelos; | |
import java.util.Random; | |
/** | |
* Created by lucas on 26/11/15. | |
*/ | |
public interface Scrambler { | |
Random RANDOM = new Random(System.nanoTime()); | |
String getSequence(); | |
} |
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
package HueTimer.auxiliares; | |
/** | |
* Created by lucas on 31/10/15. | |
*/ | |
public interface ScramblesConstants { | |
int RUBIKS_CUBE = 0; | |
int POCKET_CUBE = 1; | |
int SKEWB = 2; | |
int MEGAMINX = 3; | |
int SQUARE = 4; | |
int CLOCK = 5; | |
} |
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
package HueTimer.modelos; | |
import HueTimer.auxiliares.TimeFormater; | |
/** | |
* Created by lucas on 15/11/15. | |
*/ | |
public class Solve { | |
private int positionCounter; | |
private long elapsedTime; | |
private String scrambleSequence; | |
public Solve(int positionCounter, long elapsedTime, String scrambleSequence){ | |
this.positionCounter = positionCounter; | |
this.elapsedTime = elapsedTime; | |
this.scrambleSequence = scrambleSequence; | |
} | |
public int getPositionCounter(){ | |
return positionCounter; | |
} | |
public long getElapsedTime(){ | |
return elapsedTime; | |
} | |
public String getScrambleSequence(){ | |
return scrambleSequence; | |
} | |
@Override | |
public String toString() { | |
return positionCounter + "°) " + TimeFormater.getTimeFormated(elapsedTime) + " " + scrambleSequence + " "; | |
} | |
} |
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
package HueTimer.embaralhadores; | |
import HueTimer.modelos.Scrambler; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Random; | |
/** | |
* Created by lucas on 15/11/15. | |
*/ | |
public class SquareOne implements Scrambler { | |
Random rand = new Random(System.nanoTime()); | |
int[] p = {1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0}; | |
ArrayList<int[]> seq = new ArrayList<int[]>(); | |
@Override | |
public String getSequence() { | |
seq.clear(); | |
p = new int[]{1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0}; | |
getseq(); | |
String s = ""; | |
for (int i = 0; i < seq.size(); i++) { | |
if (seq.get(i)[0] == 7) { | |
s += "/"; | |
} else { | |
s += " (" + seq.get(i)[0] + "," + seq.get(i)[1] + ") "; | |
} | |
} | |
return s; | |
} | |
public void getseq() { | |
int cnt = 0; | |
int len = 16; | |
while (cnt < len) { | |
int x = rand.nextInt(12) - 5; | |
int y = rand.nextInt(12) - 5; | |
int size = ((x == 0) ? 0 : 1) + ((y == 0) ? 0 : 1); | |
if (size > 0 || cnt == 0) { | |
if (domove(x, y)) { | |
int[] m = {x, y}; | |
if (size > 0) seq.add(m); | |
cnt++; | |
int[] n = {7, 0}; | |
seq.add(n); | |
domove(7, 0); | |
} | |
} | |
} | |
} | |
private boolean domove(int x, int y) { | |
if (x == 7) { | |
for (int i = 0; i < 6; i++) { | |
int temp = p[i + 6]; | |
p[i + 6] = p[i + 12]; | |
p[i + 12] = temp; | |
} | |
return true; | |
} | |
else { | |
if (p[(17 - x) % 12] == 1 || p[(11 - x) % 12] == 1 || p[12 + ((17 - y) % 12)] == 1 || p[12 + ((11 - y) % 12)] == 1) { | |
return false; | |
} | |
else { | |
int[] px = Arrays.copyOfRange(p, 0, 12); | |
int[] py = Arrays.copyOfRange(p, 12, 24); | |
for (int i = 0; i < 12; i++) { | |
p[i] = px[(12 + i - x) % 12]; | |
p[i + 12] = py[(12 + i - y) % 12]; | |
} | |
return true; | |
} | |
} | |
} | |
} |
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
package HueTimer.auxiliares; | |
import java.text.SimpleDateFormat; | |
/** | |
* Created by lucas on 31/10/15. | |
*/ | |
public class TimeFormater { | |
public static String getTimeFormated(long time){ | |
long minutes = Long.parseLong(new SimpleDateFormat("m").format(time)); | |
if (minutes == 0){ | |
return new SimpleDateFormat("ss.SSS").format(time); | |
} else { | |
return new SimpleDateFormat("mm:ss.SSS").format(time); | |
} | |
} | |
} |
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
package HueTimer.modelos; | |
import java.awt.event.KeyListener; | |
/** | |
* Created by lucas on 31/10/15. | |
*/ | |
public abstract class TimerModel implements KeyListener { | |
public abstract boolean getInspectionEnabled(); | |
public abstract void startTimer(); | |
public abstract void stopTimer(); | |
public abstract void startInspection(); | |
public abstract void stopInspection(); | |
public abstract void globalTimerController(); | |
} |
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
package HueTimer.provedores; | |
import HueTimer.auxiliares.Chronometer; | |
import HueTimer.auxiliares.Inspection; | |
import HueTimer.modelos.TimerModel; | |
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.KeyEvent; | |
import java.util.Timer; | |
import java.util.TimerTask; | |
/** | |
* Created by lucas on 31/10/15. | |
*/ | |
public class TimerProvider extends TimerModel { | |
private JLabel targetLabel; | |
private JCheckBox inspCheckBox; | |
private Timer repeater, inspRepeater; | |
private boolean chronometerRunning, inspectionRunning; | |
private long delayRate = 500; | |
private static long currentTime; | |
private static boolean podeMudar = false, podeSalvar = false; | |
public TimerProvider(JLabel targetLabel, JCheckBox inspCheckBox) { | |
this.targetLabel = targetLabel; | |
this.inspCheckBox = inspCheckBox; | |
this.getInspectionEnabled(); | |
} | |
boolean inspectionEnabled; | |
@Override | |
public boolean getInspectionEnabled() { | |
inspCheckBox.addActionListener(e -> { | |
inspectionEnabled = inspCheckBox.isSelected(); | |
if (inspectionEnabled == true) { | |
delayRate = 20; | |
} else { | |
delayRate = 500; | |
} | |
}); | |
podeMudar = false; | |
podeSalvar = false; | |
return inspectionEnabled; | |
} | |
@Override | |
public void startTimer() { | |
inspCheckBox.setEnabled(false); | |
chronometerRunning = true; | |
Chronometer c = new Chronometer(targetLabel); | |
currentTime = c.getElapsedTimeValue(); | |
repeater = new Timer(); | |
repeater.scheduleAtFixedRate(c, 0, 1); | |
} | |
@Override | |
public void stopTimer() { | |
inspCheckBox.setEnabled(true); | |
chronometerRunning = false; | |
repeater.cancel(); | |
repeater = null; | |
} | |
@Override | |
public void startInspection() { | |
inspCheckBox.setEnabled(false); | |
inspectionRunning = true; | |
Inspection insp = new Inspection(targetLabel); | |
inspRepeater = new Timer(); | |
inspRepeater.scheduleAtFixedRate(insp, 0, 1000); | |
podeMudar = false; | |
} | |
@Override | |
public void stopInspection() { | |
inspectionRunning = false; | |
inspRepeater.cancel(); | |
inspRepeater = null; | |
podeMudar = false; | |
} | |
@Override | |
public void globalTimerController() { | |
if (this.getInspectionEnabled()) { | |
delayRate = 10; | |
if (!inspectionRunning && !chronometerRunning) { | |
startInspection(); | |
delayRate = 300; | |
} else if (inspectionRunning && !chronometerRunning) { | |
stopInspection(); | |
startTimer(); | |
} | |
} else { | |
if (!chronometerRunning) { | |
startTimer(); | |
} | |
} | |
} | |
public static boolean podeMudarScramble(){ | |
//pode mudar kkk | |
return podeMudar; | |
} | |
public static boolean podeSalvarSolve(){ | |
// | |
return podeSalvar; | |
} | |
public static long getCurrentTime(){ | |
return currentTime; | |
} | |
private Timer tt; | |
private boolean longo; | |
@Override | |
public void keyPressed(KeyEvent e) { | |
if (e.getKeyCode() == 32) { | |
targetLabel.setForeground(Color.RED); | |
if (!chronometerRunning) { | |
if (tt == null) { | |
tt = new Timer(); | |
tt.schedule(new TimerTask() { | |
@Override | |
public void run() { | |
targetLabel.setForeground(Color.GREEN); | |
longo = true; | |
} | |
}, delayRate, 1); | |
} | |
} else { | |
targetLabel.setForeground(Color.GREEN); | |
stopTimer(); | |
podeMudar = true; | |
podeSalvar = true; | |
} | |
} | |
} | |
@Override | |
public void keyReleased(KeyEvent e) { | |
if (e.getKeyCode() == 32) { | |
targetLabel.setForeground(Color.WHITE); | |
if (tt != null) { | |
tt.cancel(); | |
tt = null; | |
podeMudar = false; | |
podeSalvar = false; | |
} | |
if (longo == true) { | |
longo = false; | |
this.globalTimerController(); | |
} | |
} | |
} | |
@Override | |
public void keyTyped(KeyEvent e) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment