using array sorting

how to create java using array sorting

Page 1 of 1

2 Replies - 971 Views - Last Post: 23 September 2009 - 07:47 PM Rate Topic: -----

Poll: sorting array (0 member(s) have cast votes)

array

Vote Guests cannot vote

#1 suteke20  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-September 09

using array sorting

Posted 23 September 2009 - 07:35 PM

i need to know how to create array sorting with JLabel :wub:
somebody there help. me cause am just a beginner

This post has been edited by suteke20: 23 September 2009 - 07:36 PM

Is This A Good Question/Topic? 0
  • +

Replies To: using array sorting

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6037
  • View blog
  • Posts: 23,432
  • Joined: 23-August 08

Re: using array sorting

Posted 23 September 2009 - 07:42 PM

Wrong forum. Moving to Java.
Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: using array sorting

Posted 23 September 2009 - 07:47 PM

View Postsuteke20, on 23 Sep, 2009 - 06:35 PM, said:

i need to know how to create array sorting with JLabel :wub:
somebody there help. me cause am just a beginner

Just overload JLabel... make your class implements Comparable and sort the way you want

To sort by lthe abel text as example:

class MyLabel extends JLabel implements Comparable<MyLabel> {
	....
	int compareTo(MyLabel otherLabel) {
		return getText().compareTo(otherLabel.getText());
	}
}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1