Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Help with processing

  1. #1
    Junior Member
    Join Date
    Jun 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with processing

    Hey guys, i have a question about my code. I have everything necessary for the processing working, and the program runs fine, but whenever it gets to the line with processing, it brings up errors. here is the processing class:
    import processing.core.*;
     
    public class processing extends PApplet {
    	public void setup(){
    		background(12, 90, 45);
    	}
    	public void draw(){
    		rect(mouseX,mouseY, 40, 35);
    	}
    }
    and here is where i try to import it:
    public class timerWindow1 extends JFrame implements ActionListener { 	
    	// clock 
    	Timer clock = new Timer(1000, this); 
    	processing shapes = new processing();
     
    	//button variables 
    	JButton  Baron, Dragon, theirRed, ourRed, theirBlue, ourBlue, theirWraiths, ourWraiths, theirGolems, ourGolems, theirWolves, ourWolves, theirWight, ourWight; 
    	JLabel bname, dname, trname, orname, tbname, obname, twname, owname, tgname, ogname, twoname, owoname, twiname, owiname; 
     
    	//Seconds
    	Integer baronTimer = 60, dragonTimer = 60, trTimer = 60, orTimer = 60, tbTimer = 60, obTimer = 60, twTimer = 50, owTimer = 50, tgTimer = 0, ogTimer = 0, twoTimer = 50, owoTimer = 50, twiTimer = 50, owiTimer = 50; 
     
    	//Minutes
    	Integer baronMTimer = 6, dragonMTimer = 5, trMTimer = 4, orMTimer = 4, tbMTimer = 4, obMTimer = 4, twMTimer = 0, owMTimer = 0, tgMTimer = 1, ogMTimer = 1, twoMTimer = 0, owoMTimer = 0, twiMTimer = 0, owiMTimer = 0; 
    	boolean dragonRunning, baronRunning, tredRunning, oredRunning, tblueRunning, oblueRunning, twraithsRunning, owraithsRunning, tgolemsRunning, ogolemsRunning, twolvesRunning, owolvesRunning, twightRunning, owightRunning; 
     
    	//key actions
    	KeyEvent button1; 
    	KeyListener all; 
     
    	//the window constructor 
    	timerWindow1 (String title){ 
    		super (title); 
    		this.init(); 
    		this.setSize(900, 600); 
    		this.setVisible(true); 
    		shapes.setup();
    		shapes.draw();
    	}
    that isnt the whole program, but it is what is causing the problem i believe. any help would be great thanks.
    Last edited by MAK; June 25th, 2014 at 09:16 AM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help with processing

    it brings up errors
    Please copy the full text and paste it here.

    Please edit your post and wrap your code with code tags:
    [code=java]
    YOUR CODE GOES HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jun 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help with processing

    here is the whole thing

    main:

    import java.awt.Window;
    import javax.swing.JFrame;
     
     
    public class Main {
     
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		Window titleScreen = new titleScreen ("Welcome!");
    		((JFrame) titleScreen).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	}
     
    }

    timer class
    import javax.swing.JFrame; 
    import javax.swing.JLabel; 
    import javax.swing.JPanel; 
    import javax.swing.JButton; 
    import javax.swing.Timer; 
    import java.awt.Color; 
    import java.awt.Component; 
    import java.awt.GridLayout; 
    import java.awt.Toolkit; 
    import java.awt.event.ActionListener; 
    import java.awt.event.ActionEvent; 
    import java.awt.event.KeyEvent; 
    import java.awt.event.KeyListener; 
    import processing.core.*;
    /*Matt Kuhn 
     * 6-28-13 
     *  
     *  
     * this is a Jungle Timer for League of Legends 
     */
     
     
     
    public class timerWindow1 extends JFrame implements ActionListener { 	
    	// clock 
    	Timer clock = new Timer(1000, this); 
    	processing shapes = new processing();
     
    	//button variables 
    	JButton  Baron, Dragon, theirRed, ourRed, theirBlue, ourBlue, theirWraiths, ourWraiths, theirGolems, ourGolems, theirWolves, ourWolves, theirWight, ourWight; 
    	JLabel bname, dname, trname, orname, tbname, obname, twname, owname, tgname, ogname, twoname, owoname, twiname, owiname; 
     
    	//Seconds
    	Integer baronTimer = 60, dragonTimer = 60, trTimer = 60, orTimer = 60, tbTimer = 60, obTimer = 60, twTimer = 50, owTimer = 50, tgTimer = 0, ogTimer = 0, twoTimer = 50, owoTimer = 50, twiTimer = 50, owiTimer = 50; 
     
    	//Minutes
    	Integer baronMTimer = 6, dragonMTimer = 5, trMTimer = 4, orMTimer = 4, tbMTimer = 4, obMTimer = 4, twMTimer = 0, owMTimer = 0, tgMTimer = 1, ogMTimer = 1, twoMTimer = 0, owoMTimer = 0, twiMTimer = 0, owiMTimer = 0; 
    	boolean dragonRunning, baronRunning, tredRunning, oredRunning, tblueRunning, oblueRunning, twraithsRunning, owraithsRunning, tgolemsRunning, ogolemsRunning, twolvesRunning, owolvesRunning, twightRunning, owightRunning; 
     
    	//key actions
    	KeyEvent button1; 
    	KeyListener all; 
     
    	//the window constructor 
    	timerWindow1 (String title){ 
    		super (title); 
    		this.init(); 
    		this.setSize(900, 600); 
    		this.setVisible(true); 
    		shapes.setup();
    		shapes.draw();
    	} 
     
    	void init(){ 
    		//the timers 
    		bname = new JLabel("7:00");//Baron 
    		dname = new JLabel("6:00");//Dragon 
    		trname = new JLabel("5:00");//their red 
    		orname = new JLabel("5:00");//our red 
    		tbname = new JLabel("5:00");//their blue 
    		obname = new JLabel("5:00");//our blue 
    		twname = new JLabel("0:50");//their wraiths 
    		owname = new JLabel("0:50");//our wraiths 
    		tgname = new JLabel("1:00");//their golems 
    		ogname = new JLabel("1:00");//our golems 
    		twoname = new JLabel("0:50");//their wolves 
    		owoname = new JLabel("0:50");//our wolves 
    		twiname = new JLabel("0:50");//their wight
    		owiname = new JLabel("0:50");//our wight
     
    		//button setup 
     
    		Baron = new JButton("Baron"); 
    		Dragon = new JButton("Dragon"); 
    		theirRed = new JButton("Their red"); 
    		ourRed= new JButton("Our red"); 
    		theirBlue = new JButton("Their blue"); 
    		ourBlue = new JButton("Our blue"); 
    		theirWraiths = new JButton("Their wraiths"); 
    		ourWraiths = new JButton("Our wraiths"); 
    		theirGolems = new JButton("Their golems"); 
    		ourGolems = new JButton("Our golems"); 
    		theirWolves = new JButton("Their wolves"); 
    		ourWolves = new JButton("Our wolves"); 
    		theirWight = new JButton("Their wight");
    		ourWight = new JButton("Our wight");
     
    		//button colors 
    		Color coolOrange = new Color(242, 161, 33); 
    		Color coolAqua = new Color(8, 196, 138);
    		Baron.setBackground(Color.MAGENTA); 
    		Dragon.setBackground(coolOrange); 
    		theirRed.setBackground(Color.RED); 
    		ourRed.setBackground(Color.RED); 
    		theirBlue.setBackground(Color.BLUE); 
    		ourBlue.setBackground(Color.BLUE); 
    		theirWraiths.setBackground(Color.GRAY); 
    		ourWraiths.setBackground(Color.GRAY); 
    		theirGolems.setBackground(Color.GREEN); 
    		ourGolems.setBackground(Color.GREEN);        
    		theirWolves.setBackground(Color.LIGHT_GRAY); 
    		ourWolves.setBackground(Color.LIGHT_GRAY); 
    		theirWight.setBackground(coolAqua);
    		ourWight.setBackground(coolAqua);
     
    		//button listeners 
    		Baron.addActionListener(this); 
    		Dragon.addActionListener(this); 
    		theirRed.addActionListener(this); 
    		ourRed.addActionListener(this); 
    		theirBlue.addActionListener(this); 
    		ourBlue.addActionListener(this); 
    		theirWraiths.addActionListener(this); 
    		ourWraiths.addActionListener(this); 
    		theirGolems.addActionListener(this); 
    		ourGolems.addActionListener(this); 
    		theirWolves.addActionListener(this); 
    		ourWolves.addActionListener(this); 
    		theirWight.addActionListener(this);
    		ourWight.addActionListener(this);
     
    		//key listeners 
    		//((Component) all).addKeyListener((KeyListener) this); 
    		//      Dragon.addKeyListener(this); 
    		//      theirRed.addKeyListener(this); 
    		//      ourRed.addKeyListener(this); 
    		//      theirBlue.addKeyListener(this); 
    		//      ourBlue.addKeyListener(this); 
    		//      theirWraiths.addKeyListener(this); 
    		//      ourWraiths.addKeyListener(this); 
    		//      theirGolems.addKeyListener(this); 
    		//      ourGolems.addKeyListener(this); 
    		//      theirWolves.addKeyListener(this); 
    		//      ourWolves.addKeyListener(this); 
     
    		//timer and button panels 
    		JPanel panel = new JPanel(new GridLayout(7,2)); 
    		panel.add(Baron); 
    		panel.add(bname);        
    		panel.add(Dragon); 
    		panel.add(dname); 
    		panel.add(theirRed); 
    		panel.add(trname); 
    		panel.add(ourRed); 
    		panel.add(orname); 
    		panel.add(theirBlue); 
    		panel.add(tbname); 
    		panel.add(ourBlue); 
    		panel.add(obname); 
    		panel.add(theirWraiths); 
    		panel.add(twname); 
    		panel.add(ourWraiths); 
    		panel.add(owname); 
    		panel.add(theirGolems); 
    		panel.add(tgname); 
    		panel.add(ourGolems); 
    		panel.add(ogname); 
    		panel.add(theirWolves);  
    		panel.add(twoname); 
    		panel.add(ourWolves); 
    		panel.add(owoname); 
    		panel.add(theirWight);
    		panel.add(twiname);
    		panel.add(ourWight);
    		panel.add(owiname);
     
     
     
    		Toolkit.getDefaultToolkit().beep(); 
     
    		//checks for timers 
    		clock.start(); 
     
    		//adds it all 
    		this.add(panel); 
    	} 
    	@Override
    	public void actionPerformed(ActionEvent e) { 
    		// TODO Auto-generated method stub 
     
    		//if button is pushed start clock 
    		if (e.getSource() == Baron ) 
    		{ 
    			baronRunning = true; 
    		} 
    		if (e.getSource() == Dragon ){ 
    			dragonRunning = true; 
    		} 
    		if (e.getSource() == theirRed){ 
    			tredRunning = true; 
    		} 
    		if (e.getSource() == ourRed){ 
    			oredRunning = true; 
    		} 
    		if (e.getSource() == theirBlue){ 
    			tblueRunning = true; 
    		} 
    		if (e.getSource() == ourBlue){ 
    			oblueRunning = true; 
    		} 
    		if (e.getSource() == theirWraiths){ 
    			twraithsRunning = true; 
    		} 
    		if (e.getSource() == ourWraiths){ 
    			owraithsRunning = true; 
    		} 
    		if (e.getSource() == theirGolems ){ 
    			tgolemsRunning = true; 
    		} 
    		if (e.getSource() == ourGolems){ 
    			ogolemsRunning = true; 
    		} 
    		if (e.getSource() == theirWolves){ 
    			twolvesRunning = true; 
    		} 
    		if (e.getSource() == ourWolves){ 
    			owolvesRunning = true; 
    		} 
    		if (e.getSource() == theirWight){ 
    			twightRunning = true; 
    		} 
    		if (e.getSource() == ourWight){ 
    			owightRunning = true; 
    		} 
     
     
    		//clock running mechanics 
    		if(baronRunning && e.getSource()==clock){ 
    			if(baronMTimer == 0 && baronTimer == 0) 
    			{ 
    				baronRunning = false; 
    				baronTimer = 00; 
    				baronMTimer = 7; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
     
    			if(baronTimer == 0) 
    			{ 
    				baronMTimer--; 
    				baronTimer = 60; 
    			} 
     
    			baronTimer--; 
     
    			if(baronTimer < 10) 
    			{ 
    				bname.setText(baronMTimer.toString() + ":0" + baronTimer.toString()); 
    			} 
    			else
    			{ 
    				bname.setText(baronMTimer.toString() + ":" + baronTimer.toString()); 
    			} 
     
    		} 
     
    		if(dragonRunning && e.getSource()==clock){ 
    			if(dragonMTimer == 0 && dragonTimer == 0) 
    			{ 
    				dragonRunning = false; 
    				dragonTimer = 01; 
    				dragonMTimer = 6; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
     
    			if(dragonTimer == 0) 
    			{ 
    				dragonMTimer--; 
    				dragonTimer = 60; 
    			} 
     
    			dragonTimer--; 
     
    			if(dragonTimer < 10) 
    			{ 
    				dname.setText(dragonMTimer.toString() + ":0" + dragonTimer.toString()); 
    			} 
    			else
    			{ 
    				dname.setText(dragonMTimer.toString() + ":" + dragonTimer.toString()); 
    			} 
    		} 
    		if(tredRunning && e.getSource()==clock){ 
    			if(trMTimer == 0 && trTimer == 0) 
    			{ 
    				tredRunning = false; 
    				trTimer = 01; 
    				trMTimer = 5; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
    			if(trTimer==0) 
    			{ 
    				trMTimer--; 
    				trTimer = 60; 
    			} 
    			trTimer--; 
     
    			if(trTimer < 10) 
    			{ 
    				trname.setText(trMTimer.toString() + ":0" + trTimer.toString()); 
    			} 
    			else
    			{ 
    				trname.setText(trMTimer.toString() + ":" + trTimer.toString()); 
    			} 
    		} 
     
    		if(oredRunning && e.getSource()==clock){ 
    			if(orTimer == 0 && orMTimer == 0) 
    			{ 
    				oredRunning = false; 
    				orTimer = 01; 
    				orMTimer = 5; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
     
    			if(orTimer == 0) 
    			{ 
    				orMTimer--; 
    				orTimer = 60; 
    			} 
    			orTimer--; 
     
    			if(orTimer < 10) 
    			{ 
    				orname.setText(orMTimer.toString() + ":0" + orTimer.toString()); 
    			} 
    			else
    			{ 
    				orname.setText(orMTimer.toString() + ":" + orTimer.toString()); 
    			} 
    		} 
     
    		if(tblueRunning && e.getSource()==clock){ 
    			if(tbTimer== 0 && tbMTimer ==0) 
    			{ 
    				tblueRunning = false; 
    				tbTimer = 01; 
    				tbMTimer = 5; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
     
    			if(tbTimer== 0) 
    			{ 
    				tbMTimer--; 
    				tbTimer = 60; 
    			} 
    			tbTimer--; 
     
    			if (tbTimer < 10) 
    			{ 
    				tbname.setText(tbMTimer.toString() + ":0" + tbTimer.toString()); 
    			} 
     
    			else
    			{    
    				tbname.setText(tbMTimer.toString() + ":" + tbTimer.toString()); 
    			} 
    		} 
     
    		if(oblueRunning && e.getSource()==clock){ 
    			if (obTimer == 0 && obMTimer == 0) 
    			{ 
    				oblueRunning = false; 
    				obTimer = 01; 
    				obMTimer = 5; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
    			if(obTimer == 0) 
    			{ 
    				obMTimer--; 
    				obTimer = 60; 
    			} 
    			obTimer--; 
    			if (obTimer < 10) 
    			{ 
    				obname.setText(obMTimer.toString() + ":0" + obTimer.toString()); 
    			} 
    			else
    			{ 
    				obname.setText(obMTimer.toString() + ":" + obTimer.toString()); 
    			} 
    		} 
     
    		if(twraithsRunning && e.getSource()==clock){ 
    			if(twTimer == 0 && twMTimer == 0) 
    			{ 
    				twraithsRunning = false; 
    				twTimer = 51; 
    				twMTimer = 0; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
     
     
    			twTimer--; 
    			if(twTimer < 10) 
    			{ 
    				twname.setText(twMTimer.toString() + ":0" + twTimer.toString()); 
    			} 
    			else
    			{ 
    				twname.setText(twMTimer.toString() + ":" + twTimer.toString()); 
    			} 
    		} 
     
    		if(owraithsRunning && e.getSource()==clock){ 
    			if(owMTimer == 0 && owTimer == 0) 
    			{ 
    				owraithsRunning = false; 
    				owTimer = 51;  
    				owMTimer = 0; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
     
    			owTimer--; 
    			if (owTimer < 10) 
    			{ 
    				owname.setText(owMTimer.toString() + ":0" + owTimer.toString()); 
    			} 
    			else
    			{ 
    				owname.setText(owMTimer.toString() + ":" + owTimer.toString()); 
    			} 
     
     
    		} 
    		if(tgolemsRunning && e.getSource()==clock){ 
    			if(tgMTimer== 0 && tgTimer == 0) 
    			{ 
    				tgolemsRunning = false; 
    				tgTimer = 1; 
    				tgMTimer = 1; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
     
    			if(tgTimer==0) 
    			{ 
    				tgMTimer--; 
    				tgTimer = 60; 
    			} 
     
    			tgTimer--; 
    			if(tgTimer < 10) 
    			{ 
    				tgname.setText(tgMTimer.toString() + ":0" + tgTimer.toString()); 
     
    			} 
    			else
    			{ 
    				tgname.setText(tgMTimer.toString() + ":" + tgTimer.toString()); 
    			} 
    		} 
    		if(ogolemsRunning && e.getSource()==clock){ 
    			if(ogMTimer==0 && ogTimer == 0) 
    			{ 
    				ogolemsRunning = false; 
    				ogTimer = 1; 
    				ogMTimer = 1
    						; 
    				Toolkit.getDefaultToolkit().beep(); 
     
    			}    
    			if(ogTimer == 0) 
    			{ 
    				ogMTimer--; 
    				ogTimer = 60; 
    			} 
    			ogTimer--; 
    			if (ogTimer < 10) 
    			{ 
    				ogname.setText(ogMTimer.toString() + ":0" + ogTimer.toString()); 
    			} 
    			else
    			{ 
    				ogname.setText(ogMTimer.toString() + ":" + ogTimer.toString()); 
    			} 
    		} 
    		if(twolvesRunning && e.getSource()==clock){ 
    			if(twoMTimer == 0 && twoTimer == 0) 
    			{ 
    				twolvesRunning = false; 
    				twoTimer = 51; 
    				twoMTimer = 0; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
    			if (twoTimer == 0) 
    			{ 
    				twoMTimer--; 
    				twoTimer = 60; 
    			} 
     
    			twoTimer--; 
    			if(twoTimer < 10) 
    			{ 
    				twoname.setText(twoMTimer.toString() + ":0" + twoTimer.toString()); 
    			} 
    			else
    			{ 
    				twoname.setText(twoMTimer.toString() + ":" + twoTimer.toString()); 
    			} 
    		} 
     
    		if(owolvesRunning && e.getSource()==clock){ 
    			if(owoTimer == 0 && owoMTimer == 0) 
    			{ 
    				owolvesRunning = false; 
    				owoTimer = 51; 
    				owoMTimer = 0; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
    			if(owoTimer == 0) 
    			{ 
    				owoMTimer--; 
    				owoTimer = 60; 
    			} 
     
    			owoTimer--; 
    			if(owoTimer < 10) 
    			{ 
    				owoname.setText(owoMTimer.toString() + ":0" + owoTimer.toString()); 
    			} 
    			else
    			{ 
    				owoname.setText(owoMTimer.toString() + ":" + owoTimer.toString()); 
    			} 
     
     
     
     
    		}
    		if(twightRunning && e.getSource()==clock){ 
    			if(twiTimer == 0 && twMTimer == 0) 
    			{ 
    				twightRunning = false; 
    				twiTimer = 51; 
    				twiMTimer = 0; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
     
     
    			twiTimer--; 
    			if(twiTimer < 10) 
    			{ 
    				twiname.setText(twiMTimer.toString() + ":0" + twiTimer.toString()); 
    			} 
    			else
    			{ 
    				twiname.setText(twiMTimer.toString() + ":" + twiTimer.toString()); 
    			} 
    		}
    		if(owightRunning && e.getSource()==clock){ 
    			if(owiMTimer == 0 && owiTimer == 0) 
    			{ 
    				owightRunning = false; 
    				owiTimer = 51; 
    				owiMTimer = 0; 
    				Toolkit.getDefaultToolkit().beep(); 
    			} 
    			if (owiTimer == 0) 
    			{ 
    				owiMTimer--; 
    				owiTimer = 60; 
    			} 
     
    			owiTimer--; 
    			if(owiTimer < 10) 
    			{ 
    				owiname.setText(owiMTimer.toString() + ":0" + owiTimer.toString()); 
    			} 
    			else
    			{ 
    				owiname.setText(owiMTimer.toString() + ":" + owiTimer.toString()); 
    			} 
    		} 
     
    	} 
    //	@Override
    //	public void keyTyped(KeyEvent e) { 
    //		// TODO Auto-generated method stub 
    //		button1 = e; 
    //		if (e.getSource() == button1){ 
    //			baronRunning = true; 
    //
    //		} 
    //	} 
    //	@Override
    //	public void keyPressed(KeyEvent e) { 
    //		// TODO Auto-generated method stub 
    //		button1 = e; 
    //		if (e.getSource() == button1){ 
    //			baronRunning = true; 
    //
    //		} 
    //	} 
    //	@Override
    //	public void keyReleased(KeyEvent e) { 
    //		// TODO Auto-generated method stub 
    //		button1 = e; 
    //		if (e.getSource() == button1){ 
    //			baronRunning = true; 
    //
    //		} 
    	}

    tips class
    import javax.swing.JFrame; 
    import javax.swing.JPanel; 
    import java.awt.Color; 
    import javax.swing.JLabel;
    import processing.core.*;
     
    public class tips extends JFrame {
     
    	processing shapes = new processing();
     
    	//	shapes.setup();
    	//	shapes.draw();
    	//	
    	JLabel tipSheet;
    	JPanel panel;
     
    	tips (String title){
    		super (title); 
    		this.init(); 
    		this.setSize(600, 300); 
    		this.setVisible(true); 
    	}
    	public void init(){
    		JPanel panel = new JPanel();
    		panel.add(new JLabel ("Tips"));
    		panel.add(new JLabel ("1:56- Check lanes to see who leashed where. 2:15- ward lane if jungler started on your side. "));
    		panel.add(new JLabel ("3:00 ward lane if jungler started other side. 7:20 & 8:00 ward if"));
    		panel.add(new JLabel(" jungler started your side and opposite side."));
    		panel.add(new JLabel("Flash & tp = 5 mins, heal = 4, all else = 3.5"));
    		panel.setBackground(Color.CYAN);
    		this.add(panel);
     
    	}
    }

    title screen

    import javax.swing.JFrame; 
    import javax.swing.JPanel; 
    import javax.swing.JButton; 
    import javax.swing.Timer; 
    import java.awt.Color; 
    import java.awt.Component; 
    import java.awt.GridLayout; 
    import java.awt.Toolkit; 
    import java.awt.Window;
    import java.awt.event.ActionListener; 
    import java.awt.event.ActionEvent; 
    import java.awt.event.KeyEvent; 
    import java.awt.event.KeyListener;
    import javax.swing.JLabel;
     
    public class titleScreen extends JFrame implements ActionListener {
    	JButton timers, tips; 
    	titleScreen (String title){
    		super (title); 
    		this.init(); 
    		this.setSize(900, 300); 
    		this.setVisible(true); 
    	}
    	void init(){
    		// buttons
    		timers = new JButton ("Timers");
    		tips = new JButton ("Tips");
     
    		//colors
    		timers.setBackground(Color.CYAN);
    		tips.setBackground(Color.PINK);
     
    		//button listeners
    		timers.addActionListener(this);
    		tips.addActionListener(this);
     
    		//panels
    		JPanel panel = new JPanel(new GridLayout(2,1));
    		panel.add(timers);
    		panel.add(tips);
     
    		this.add(panel);
     
    	}
    	@Override
    	public void actionPerformed(ActionEvent e) {
    		// TODO Auto-generated method stub
    		if ((JButton) e.getSource() == timers){
    			Window timerWindow1 = new timerWindow1 ("Timers");
    		}
    		if (e.getSource() == tips){
    			Window tips = new tips ("Tips");
    		}
     
    	}
     
     
    }

    proocessing

    import processing.core.*;
     
    public class processing extends PApplet {
    	public void setup(){
    		background(12, 90, 45);
    	}
    	public void draw(){
    		rect(mouseX,mouseY, 40, 35);
    	}
    }
    [/I]

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help with processing

    it brings up errors.
    You forgot to post the full text of the error messages.

    Are the contents of the processing.code package important? The code can not be compiled and executed for testing without those classes.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Jun 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help with processing

    here is the error:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at processing.core.PApplet.background(PApplet.java:15 157)
    at processing.setup(processing.java:5)
    at timerWindow1.<init>(timerWindow1.java:50)
    at titleScreen.actionPerformed(titleScreen.java:49)
    at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    processing.core is what allows the processing, as it contains all the necessary libraries.

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Help with processing

    You've got a lot going on here. Why do you have so many classes that extend JFrame? Which specific one is causing the NPE?

    You'd be much better off creating an MCVE that we can look at instead of posting your entire project. You should also use standard naming conventions: classes start with an upper-case letter, methods and variables start with a lower-case letter.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help with processing

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at processing.core.PApplet.background(PApplet.java:15 157)
    There is a null value used on line 15157. (That's a HUGE class file.) Look at that line and see what varible had a null value. And then backtrack to see why.

    Don't post that code.
    If you don't understand my answer, don't ignore it, ask a question.

  8. #8
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Help with processing

    PApplet is an internal Processing class (and yeah, it is huge), not in the OP's code. I predict he's doing something wrong in the setup, since Processing requires you to call a couple methods before using it.

    But I can't really be more specific until we see an MCVE.

    Edit: Just guessing, but this error might be caused by calling background() from setup() before anything has been initialized. But again, that might also just be because you aren't setting things up correctly. I can't really tell without the MCVE.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Image Processing
    By sachinshahi_2010 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 25th, 2013, 12:45 PM
  2. [SOLVED] processing arrays
    By 18107 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 19th, 2013, 10:34 PM
  3. Need help in image processing
    By ath in forum Object Oriented Programming
    Replies: 3
    Last Post: March 8th, 2012, 11:18 AM
  4. Processing
    By KevinWorkman in forum Other Programming Languages
    Replies: 4
    Last Post: September 6th, 2011, 10:30 AM
  5. Processing Arrays
    By av8 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 27th, 2011, 06:19 AM