0 Members and 2 Guests are viewing this topic.
button1.setBounds(5, 5, 100, 60); button2.setBounds(5, 60, 100, 60);
import javax.swing.*;import java.awt.*;import java.awt.event.*;class herp extends JFrame { JButton button1 = new JButton("Derp"); JButton button2 = new JButton("Lolwut"); button1.setBounds(5, 5, 100, 60); button2.setBounds(5, 60, 100, 60); public herp() { super("Window"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(button1); add(button2); pack(); }}class window { public static void main(String[] args) { herp hai = new herp(); hai.setVisible(true); }}
import java.awt.*;import javax.swing.*;import java.awt.event.*;class map extends JPanel { int mapMatrix[][] = new int[15][10]; String tiles[] = new String[2]; map() { this.setBounds(0, 25, 960, 640); for(int x = 0; x < 15; x++) { for(int y = 0; y < 10; y++) { ImageIcon tile = new ImageIcon(tiles[mapMatrix[x][y]]); tile.setBounds(((x + 1) * 64), ((y + 1) * 64), 64, 64); this.add(tile); tile.setVisible(true); this.setVisible(true); } } }}
Another issue: The second one says "cannot find symbol" on setBounds, add, and setVisible. All are within a method.
map.java:19: cannot find symbolsymbol : method setVisible(boolean)location: class javax.swing.ImageIcon tile.setVisible(true);