Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

gui question

Featured Replies

i have an Enum i would like to add into my gui combo box. im to lazy to retype them in a array string. i also no if i do this

JComboBox<CraftingTable> craftingTableList = new JComboBox(CraftingTable.values());

 i will get all my variable in my Enum in the combo box but the only problem is that they all in caps with and underscore and that looks unprofessional. i also no that you could add

JComboBox<String> craftingTableList = new JComboBox(arrayString);

and they will be in an the combo box. So i thought maybe if i create a String array method with the names of the Enum i could easly add them in my gui.

 

my Method:

	public static String[] getAll()	{
		List<String> list = new ArrayList<String>();
		for (CraftingTable c: values())
			if (c!=null)
				list.add(c.getName());
		return (String[]) list.toArray();
	}

//in my enum
this.name = super.name().charAt(0) + super.name().substring(1).toLowerCase().replace("_", " ");

my gui:

JComboBox<String> craftingTableList = new JComboBox(CraftingTable.getAll());

 but it doesnt show anything in my gui. Any way i could do what i want. 

in your enum:

 

@Override

public String toString() {

return "whatever you want"

}

 

Then .values will return "whatever you want".

Edited by Botrepreneur

我不明白什么。请给我解释一下?

Edited by Tigre

  • Author

 

in your enum:
 
@Override
public String toString() {
return "whatever you want"
}
 
Then .values will return "whatever you want".

 

 

Just override the toString()

thanks 

 

我不明白什么。请给我解释一下?

:p just gotta learn

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.