A Random-ish Question

I took a little two-week break from Java because I was spending a bunch of my free time on it and figured I’d be thinking differently when I got back… anyways the first thing that I started writing was a class to construct JPanels but while writing it it sort of turned into a JButton creation class. Anyways, my question is: “Is there any reason for me to finish this class and get it working?”

class MenuPanels
{
	private boolean isVisible = false;
	private int insets = 0;
	private JButton[] buttonArray;
	private int[] buttonXArray, buttonYArray;
	
	public MenuPanels(int amountOfButtons)
	{
		buttonArray = new JButton[amountOfButtons];
		buttonXArray = new Int[amountOfbuttons];
		buttonYArray = new Int[amountOfbuttons];
	}
	
	public void insetsSetter(int insets)
	{
		this.insets = insets;
	}
	
	public void buttonXSetter(int buttonIndex, int xValue)
	{
		buttonXArray[buttonIndex] = xValue;
	}
	
	public void buttonYSetter(int buttonIndex, int xValue)
	{
		buttonYArray[buttonIndex] = yValue;
	}
	
	public void buttonSetter(int buttonIndex, String buttonName, String buttonText, int boundsX, int boundsY, int width, int height, boolean hasBorder, boolean hasFocusPainted, boolean hasContentAreaFilled, boolean hasIcon, String normalIconPath, String rolloverIconPath, String pressedIconPath, boolean hasTooltip, String tooltipText)
	{
		JButton buttonName = new JButton(""+buttonText+"");
		buttonName.setBounds(boundsX + insets.left, boundsY + insets.top, width, height);
		
		if (hasBorder == false)
			buttonName.setBorder(null);
		
		if (hasFocusPainted == false)
			buttonName.setFocusPainted(false);
		
		if (hasContentAreaFilled == false)
			buttonName.setContentAreaFilled(false);
			
		if (hasIcon == true)
		{
			Icon buttonName+Icon = new ImageIcon(""+normalIconPath+"");
			Icon buttonName+Rollover = new ImageIcon(""+rolloverIconPath+"");
			Icon buttonName+Pressed = new ImageIcon(""+pressedIconPath+"");
			buttonName.setIcon(buttonName+Icon);
			buttonName.setRolloverIcon(buttonName+Rollover);
			buttonName.setPressedIcon(buttonName+Pressed);
		}
		
		if (hasTooltip == true)
			buttonName.setToolTiptext(""+tooltipText+"");
		
			buttonArray[buttonIndex] = buttonName;
		}
		
		// End of setters, beginning of getters.
		
		public JButton buttonGetter(int buttonIndex)
		{
			return buttonArray[buttonIndex]; //This would feed into the Panel creation stuff if you finish writing the class.
		}
}

The class is probably riddled with bugs and most likely wont work at the moment, it’s more of a rough outline of the class I guess.

What is with this bizarre [icode]""+someString+""[/icode] thing you have going on? Stop doing that.

Also, you don’t need to do [icode]if (something == true)[/icode]. Just use [icode]if (something)[/icode] or [icode]if (!something)[/icode] to compare it against false.

Your setter methods have bizarre names, and stuffing everything into arrays is probably not wise either.

My advice for finishing that class is to rewrite it entirely.

Agreed, “” is an empty string literal (contains nothing). And I agree with the rest of what he said too, setters and getters should be named set…() and get…() not setter() and getter() -___-

Having an array of x and ys for buttons makes no sense, the x and y should be fields of the button class, if not, then just make your ownl class extend JButton.

I’ve edited the class a bit; My question was more-so to ask what a class like this would be used for, I know it’s horribly written and that’s because it’s not supposed to be a working class, it’s an outline of a class.

This is somewhat of an odd question, especially as you said you realized the class was terrible. I’m sorry, but it simply has no use.