Note that there are some explanatory texts on larger screens.

plurals
  1. POJava: Unable to set a Window's "visible" Property to True
    primarykey
    data
    text
    <p>This is the first time I've gotten this. I've used these two simple lines of code so much, but for one reason or another, I cannot use the second; it won't work.</p> <pre><code>Secondary second = new Secondary(); second.setVisible(true); </code></pre> <p>When I try to do it, it says that the meathod "setVisible(boolean)" is undefined for second, when it really is not. Any ideas?</p> <p>Here is the "Secondary" class:</p> <pre><code>public class Secondary { private JFrame frmMyGames; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Games window = new Games(); window.frmMyGames.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Games() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frmMyGames = new JFrame(); frmMyGames.setTitle("My Games - Executioner"); frmMyGames.setBounds(100, 100, 470, 250); frmMyGames.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JTextArea Games = new JTextArea(); Games.setEnabled(false); Games.setEditable(false); Games.setFont(new Font("Calibri", Font.PLAIN, 13)); Games.setText("Please load a game list."); GroupLayout groupLayout = new GroupLayout(frmMyGames.getContentPane()); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(Games, GroupLayout.DEFAULT_SIZE, 462, Short.MAX_VALUE) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(Games, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE) ); frmMyGames.getContentPane().setLayout(groupLayout); JMenuBar menuBar = new JMenuBar(); frmMyGames.setJMenuBar(menuBar); JMenu mnFile = new JMenu("File"); menuBar.add(mnFile); JMenuItem mntmLoad = new JMenuItem("Load List"); mntmLoad.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Games.setText(""); Games.setEnabled(true); String directory = "C:/Program Files/Executioner/saves/games.ex"; BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(directory)); Games.append(reader.readLine()); Games.append("\nUsername: " + reader.readLine()); Games.append("\nPassword: " + reader.readLine()); Games.append("\n"); Games.append(reader.readLine()); Games.append("\nUsername: " + reader.readLine()); Games.append("\nPassword: " + reader.readLine()); Games.append("\n"); Games.append(reader.readLine()); Games.append("\nUsername: " + reader.readLine()); Games.append("\nPassword: " + reader.readLine()); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } String line = null; try { while ((line = reader.readLine()) != null) { } } catch (IOException e1) { e1.printStackTrace(); } } }); mnFile.add(mntmLoad); JMenuItem mntmCloseList = new JMenuItem("Close List"); mntmCloseList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Games.setText("Please load a list..."); Games.setEnabled(false); } }); mnFile.add(mntmCloseList); } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload