Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Text is getting cropped!

843806Nov 25 2007 — edited Nov 26 2007
Here is the code for my window, the problem is that all my text in the 2x2 gridLayout is getting cropped and you can only see half of it. this occurs regardless of the size of the font or what font it is.
	window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		window.addWindowListener(windowlist);
		window.setLayout(null);
		mainNorth.setLayout(new GridLayout(2,2));
		backLabel.setIcon(new ImageIcon("sprites/"+backname));
		backLabel.setBounds(0,0,sizex,sizey-25);
		window.add(mainLabel);
		window.add(backLabel);
		mainLabel.setLayout(new BorderLayout());
		mainLabel.setBounds(0,0,sizex,sizey-20);
		go.addActionListener(this);
		south.add(action);
		south.add(go);
		
		action.addItem("Select One");
		action.addItem("Info");
		action.addItem("Feed Meat");
		action.addItem("Feed Steroid");
		action.addItem("Battle");
		action.addItem("Give Medicine");
		
		window.setSize(sizex,sizey);
		window.setResizable(false);
		mainLabel.add(south,BorderLayout.SOUTH);
		mainLabel.add(digiLabel,BorderLayout.CENTER);
		mainLabel.add(mainNorth,BorderLayout.NORTH);
		
//RIGHT HERE!
                mainNorth.add(mainNorth00);
		mainNorth.add(mainNorth01);
		mainNorth.add(mainNorth10);
		mainNorth.add(mainNorth11);
		
		mainNorth00.setFont(new Font("sansserif", Font.BOLD, 15));
		mainNorth01.setFont(new Font("sansserif", Font.BOLD, 15));
		mainNorth10.setFont(new Font("sansserif", Font.BOLD, 15));
		mainNorth11.setFont(new Font("sansserif", Font.BOLD, 15));
		
		healthbutton.addActionListener(this);
		attackbutton.addActionListener(this);
		speedbutton.addActionListener(this);
		accuracybutton.addActionListener(this);
		timer=new Timer(100*60,statCaller);
		battlepaint=new Timer(400,battlePaintCaller);
		attacktimer=new Timer(1000,attackCaller);
		infopaint=new Timer(400,infoPaintCaller);
		timer.start();
		ActionListener paintCaller = new ActionListener()
		{
			public void actionPerformed(ActionEvent event)
			{
				stringCount+=1;
				if(stringCount > 3)
				{
					stringCount=0;
				}
				imageName=digi.getName()+spritenum[stringCount]+".gif";
				digiLabel.setIcon(new ImageIcon(imageName));
				mainNorth00.setText("Hunger:: "+(int)(Math.floor(hunger/4))+"/5");
				mainNorth01.setText("Strength:: "+(int)(Math.floor(strength/4))+"/5");
				mainNorth10.setText(digi.getName());
				mainNorth11.add(new JLabel(new ImageIcon("sprites/poopyimage.gif")));
				mainNorth11.add(new JLabel("X"+poop));
				if(medical>=10)
				{
					mainNorth11.add(new JLabel(new ImageIcon("sprites/poopyimage.gif")));
				}
			}
		};
Edited by: bober911 on Nov 25, 2007 2:02 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 24 2007
Added on Nov 25 2007
3 comments
68 views