Skip to content

Commit

Permalink
Make the seed easy to copy
Browse files Browse the repository at this point in the history
fix issue #34
  • Loading branch information
RoanH committed Jul 26, 2022
1 parent 122233d commit faf64a3
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Picross/src/dev/roanh/picross/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.IOException;
import java.util.function.Consumer;

Expand Down Expand Up @@ -123,6 +127,31 @@ private static final void showGameGUI(){
seedField.setEditable(false);
infoField = new JLabel("", SwingConstants.LEFT);
timerField = new JLabel("", SwingConstants.CENTER);
seedField.addMouseListener(new MouseListener(){

@Override
public void mouseReleased(MouseEvent e){
}

@Override
public void mousePressed(MouseEvent e){
}

@Override
public void mouseExited(MouseEvent e){
}

@Override
public void mouseEntered(MouseEvent e){
}

@Override
public void mouseClicked(MouseEvent e){
seedField.select(7, seedField.getText().length());
StringSelection seed = new StringSelection(board == null ? "" : board.getSeed().toString());
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(seed, seed);
}
});

JMenuBar bar = new JMenuBar();

Expand Down

0 comments on commit faf64a3

Please sign in to comment.