This forum is in archive mode. You will not be able to post new content.

Author Topic: [Java] vCard reader with GUI  (Read 2414 times)

0 Members and 1 Guest are viewing this topic.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
[Java] vCard reader with GUI
« on: October 10, 2011, 06:27:16 PM »
Simple stuff. Made a GUI for my vCard reader that I made for command line earlier (http://evilzone.org/other/(java)-vcard-reader/)
Works, but I came across few issues which I wasn't able to resolve, so I am now asking little help.

First things firs:
Jar: http://newage.ql.lt/projects/java/vCardReader/GUI/vCardReaderGUI.jar
Code: http://newage.ql.lt/projects/java/vCardReader/GUI/vCardReader.java
Sample vCard: http://newage.ql.lt/projects/java/vCardReader/GUI/vCard.vcf

Ok so, the problem is with jComboBox. Whenever I use "comboBox.removeAllItems();" I get an exception: "java.lang.IndexOutOfBoundsException: Index: -1, Size: N" (where N is the number of items previously in the comboBox).
I Googled what is happening and it seems that whenever you use removeAllItems() it tries to select something or something, I'm not quite sure myself.

What I've been bothered about is I don't know how to code a workaround for this.
Any ideas?

I tried using a checking whether a comboBox contains something or not, but that does not do much.

The code with the problem is on the line 96.

EDIT:
Nevermind. xor explained it to me and now it all works well. Code and Jar re-uploaded.
Seems that each time a state of the comboBox changes, an event is fired, and my event wants to select a non-existing item, which is -1, so a logical operator fixed it.

Code: [Select]
<xor> bithc nigger xor is da bomb yo
<xor> and guy

Fo sho thar nizzle. Crizzle bizzle, bazingizzle!
« Last Edit: October 10, 2011, 06:50:05 PM by Kulverstukas »

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.