jeudi 26 mars 2015

Drawing a gridline in the same part where I created the JPanel?



I need to build a gridline for a crossword puzzle. I wanted to know if I could do it in the same part where I created the JPanel and it's properties instead of doing it in methods?



class CrosswordWindow extends JFrame {


public JPanel crossPanel;

public CrosswordWindow() {
super("Crossword");

setLayout(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(false);

/*
bunch of buttons, labels, JLists etc.
*/

int size;
crossPanel = new JPanel();
crossPanel.setBounds(240, 40, 680, 360);
crossPanel.setBackground(Color.white);
crossPanel.setBorder(BorderFactory.createEtchedBorder(1, Color.lightGray, Color.lightGray));
add(crossPanel);


I'm having a tough time trying to draw the grid lines for the crossword.




Aucun commentaire:

Enregistrer un commentaire