Bypassing Swing, strange?

The company where I am working will use J2EE soon for their ERP.
Programmers will not have to do anything with Swing. A company made a layer (tier? I don't know how you call it in English) in front of Swing which provides something like GUI templates.
They say that it would not be productive to let programmers write a GUI using Swing, even if a visual GUI builder is used.
I fear that they don't want to train their workers so that they would be productive GUI programmers. So our company has a proprietary solution which only our company uses and programmers cannot develop Swing knowledge and are thus more bound to the company (which results in low salaries and bad career chances). They cannot easily change the company they work for since they lack of knowledge about Swing. Additionally the ERP will be build on a proprietary framework which is not very known. And still additionally the company plans to use JBoss because other application servers are too expensive.
Is it usual to create a GUI by not using native Swing? Swing would be used, but not directly.

I think it's a bad strategy for your company in the long period.
The main theme is that you can't have the help of milion of good programmers around the world to solve your daily problems in the code if you use custom components.

Similar Messages

  • Iteration, multithread access, cuncurrenthashmap, swing, Strange Error

    Hi,
    Lets start with the error:
    Exception in thread "Thread-2" java.lang.IllegalStateException
         at java.util.concurrent.ConcurrentHashMap$HashIterator.remove(Unknown Source)
         at DrawFrame$allthread.run(DrawFrame.java:569)
         at java.lang.Thread.run(Unknown Source)Next lets look at the code:
                        Iterator<Rectangle> hr = rectangles.values().iterator();
                                       while (hr.hasNext()) {
                                            Rectangle rh = hr.next();
                                                                         if (somecondition){
                                                                             hr.remove();
                                                            }So apparently it looks like I'm trying to remove a rectangle, this works fine for a while, but then will randomly break at an unexpected time. Anyone got any advice? I think the error should be apparent. By the way, this is hashmap is getting used by seperate threads... but it is a cuncurrenthashmap.
    Whats goin on?
    Nate

    Myth shot down in flames...
    package forums;
    import java.util.Iterator;
    import java.util.Map;
    import java.util.HashMap;
    import java.util.concurrent.ConcurrentMap;
    import java.util.concurrent.ConcurrentHashMap;
    class ConcurrentHashMapPutAllContainingNullTest
      public static void main(String[] args) {
        try {
          Map<Integer,String> map = new HashMap<Integer,String>();
          map.put(1, "ONE");
          map.put(2, null);
          map.put(3, "THREE");
          ConcurrentMap<Integer,String> cache = new ConcurrentHashMap<Integer,String>();
          cache.putAll(map); // this is line 19
        } catch (Exception e) {
          e.printStackTrace();
    produces
    C:\Java\home\src\forums>"C:\Program Files\Java\jdk1.6.0_07\bin\java.exe" -Xms512m -Xmx1024m -enableassertions -cp C:\Java\home\classes; forums.ConcurrentHashMapPutAllContainingNullTest
    java.lang.NullPointerException
            at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
            at java.util.concurrent.ConcurrentHashMap.putAll(ConcurrentHashMap.java:909)
            at forums.ConcurrentHashMapPutAllContainingNullTest.main(ConcurrentHashMapPutAllContainingNullTest.java:19)

  • Internationalization for dynamic data

    HI ..i want to know how to do internationalization for dynamic data that is from database...
    Please let me know
    Thanks in advance
    Rams

    HI
    You can do the trick by extending ResourceBundle (or ListResourceBundle) and write your own handleGetObject and getKeys method.
    But in that case you are forced to create different classes for different locales and follow the naming convention for bundles:
    If your class for the default locale is MyResourceBundle, then for all the other locales you have to create a class called "MyResourceBundle_"+localeName .
    But I don't know how can I bypass this strange behaviour. All the getBundle, and getBundleImpl methods are static. So if a framework call your class through ResourceBundle.getBundle() static method you are forced to do this. If you want to change you have to call your class. So you need to instantiate your ResuorceBundle class yourself.
    Bence

  • Multiple threads destroying performance

    I have an application which performs it's own graphical rendering, i.e. I completely bypass Swing/AWT and go fullscreen and just render straight to a BufferStrategy's graphics. This works fine and the render loop is in it's own thread and merrily churns away giving quite acceptable performance. However, what baffles me is that if I create just one more thread, the performance of the thread chokes. The new thread has a run() consists of just a while(true) loop that does nothing. My question is why would this second thread cause such a hit in performance?
    I'll grant the render thread has to load images and what not, but it was instantaneous before the second thread and now takes 30secs to load. Both threads are the same priority but even if I tank the priority of the second thread to low I still get the same 30 sec delay. Any ideas? If it'll help I can post the code but my main render thread needs quite a lot of support code so I'm not sure if it'd help that much and the second thread is just as I said, an empty while(true) loop.
    Thanks in advance.

    Ok, I've decided I will try the sleep(x) where x != 0
    and see the results. But I think I may also just
    restructure my code to see if I can do an on-demand
    thread instead. Not sure if it'll work for my
    purposes but I'll see. The only thing is this thread
    is used for playing a sound file, so I'll have to
    somehow work it so that sounds don't start piling up
    on each other.I've seen Swing apps do pretty impressive multimedia stunts, very smoothly -- well, after long startup anyways. So, unless you want to go through it as an exercise, I'd think using event dispatcher should work fine.
    >
    The only thing I'm really curious about is why does
    changing the thread priority to LOW not make a
    difference. Is it not possible to change time slice
    allocation that way?I've never had much success with fiddling around thread priorities. But I've never cared enough to look very closely. As I recall, JVM 1.4.1 (since 1.3?) uses native thread handler to improve performance -- look in the docs to confirm. And I don't think Windoze let you adjust thread priority, except the two broad categories: foreground/background.
    But the above passage is mostly based on my guesses and memories, and I've been willfully oblivious to Windoze. So don't sue me. ;>
    Cheers,
    Bo

  • Strange info in "Bypass Proxy Settings for These Hosts and Domains"

    For my Mac Mini my Network IP Address always has a self-assigned 169.254 number that I cannot change. Strangely, this same IP number is similar to info that is in the Proxies section (of Network Settings) under "Bypass Proxy Settings for These Hosts and Domains".
    No matter what I do, this info (*,local, 169.254/16) appears in my Network Settings in the Proxies section under "Bypass Proxy Settings for These Hosts and Domains". (I tried removing the info and it would cause the "Configure Proxies" selection to default to "Always Use PAC File". Had to go back and retrash all the plist files to have Proxies go back to "Configure Proxies-Manually". Still, the info (*,local, 169.254/16) continues to appear in the "Bypass Proxy Settings for These Hosts and Domains" section and my IP address is always a 169.254 number.)
    Comcast cable modem via direct hardwired Ethernet works fine with my other computer, so not the modem. Also, other computer does not have any info in the "Bypass Proxy Settings for These Hosts and Domains" section.
    Installed a fresh copy of OS X 11.5 on a new hard drive. Still the same problem.
    I posted this issue before but only got one responder and the problem still exists. Any clues? Somebody must know about this stuff. Help please.
    Thanks

    When your Mac wakes up, it does not yet have an IP Addresss. It wants to send a request to a Router for an apprpriste IP address to use now. But it needs to have an IP address (like a return address) to receive any messages. So, ... wait for it,
    ... it (your Mac) makes one up. There are rules that ensure it is a random address, but they always start with 169.254. It is on the same subnet with any low-order 16 bits This is the "self-assigned" range of IP Addresses. This address is only good for talking on a local network segment, for things like asking for a valid IP Address from a DHCP-enabled Router.
    In most cases, on most networks, the 169.254 self-assigned IP Address is replaced by a valid Local IP Address such as 192.168.xxx yyy or 10.0.xxx.yyy so quickly that you never even see the 169.254 Address.
    If you do see the 169.254 Address, it can be read as "Nobody will talk to me" or "Nobody will give me an IP Address". When you have this IP Address for more than an instant, you should suspect bad cables for Ethernet connections, bad signal strength or interference for wireless, Router configuration problems, or Mac configuration problems.
    Mac configuration problems are often solved by using the "Assist Me" button is System Preferences > Network  and choosing to set up again.
    Another diagnostic is to try using Network Utility and the Ping function, and Ping-ing the address of your Airport base Station, often 192.168.0.1 or 10.0.0.1 or similar. This will tell you if the Router is reachable, or there are cabling/wirelss signal problems.
    In this case, proxies are not an issue, and are simply a distraction from the real problems.

  • Strange Swing bug in Oracle's JDK7

    I have a strange bug with every java app i run with the Java 7 VM. Every frame is limited to a maximum width of 1024 pixels. Doesn't matter if you try to resize it by code or dragging the border with the mouse pointer.
    I have a Macbook with Mac OSX 10.7.5 (1280x800 resolution).
    If i try to run the apps with Apple's Java 6 VM all works as expected.
    Here is a POC:
    import javax.swing.*;
    import java.awt.*;
    public class JDK7Bug {
        public static void main(String[] args) throws InterruptedException {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
            frame.setSize(800, 400);
            Thread.sleep(100);
            System.out.println("frame.setSize(800, 400); " + frame.getSize());
            frame.setSize(1100, 400);
            Thread.sleep(100);
            System.out.println("frame.setSize(1100, 400); " + frame.getSize());
            frame.setSize(1000, 400);
            Thread.sleep(100);
            System.out.println("frame.setSize(1000, 400); "+frame.getSize());
            System.out.println("ScreenSize: "+Toolkit.getDefaultToolkit().getScreenSize());
    It outputs:
    frame.setSize(800, 400); java.awt.Dimension[width=800,height=400]
    frame.setSize(1100, 400); java.awt.Dimension[width=1024,height=400]
    frame.setSize(1000, 400); java.awt.Dimension[width=1000,height=400]
    ScreenSize: java.awt.Dimension[width=1280,height=800]

    Try wrapping everything inside main in a SwingUtilities.invokeLater. You should not do any Swing stuff outside the EDT and you can remove the Thread.sleep.
    I have tested on my Windows 8.1 with 7u45 and 7u60 and they both work
    I get the following in std.out:
    frame.setSize(800, 400); java.awt.Dimension[width=800,height=400]
    frame.setSize(1100, 400); java.awt.Dimension[width=1100,height=400]
    frame.setSize(1000, 400); java.awt.Dimension[width=1000,height=400]
    ScreenSize: java.awt.Dimension[width=2560,height=1440]

  • Strange error displaying swing frames

    A client reported a strange error with our swing application - screenshot http://i.imgur.com/zmQNB.png .
    It turned out all swing apps are showing up like this on his machine. He runs Windows XP Profesional SP2 with a Nvidia 5500 card.
    Has anyone seen this strange behavior before?
    Edited by: user6421036 on Oct 13, 2010 7:21 AM

    user6421036 wrote:
    ..He runs ... Nvidia 5500 card.Make sure it is using the latest drivers.

  • Strange SWING Behaviour

    Hi.
    Please copy/Paste the following code
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.text.*;
    import java.util.*;
    public class timer extends JFrame implements Runnable{
         Frame frame;
         Thread timer;
         private JLabel labelSec, labelMin, labelHour, labelSep1,labelSep2;
         private JButton button;
         private int secCount =0, minCount =0, hourCount=0;
         SimpleDateFormat formatter ;
         Date currentDate;
         timer() {
              super("Timer!");
              Container c = getContentPane();
              c.setLayout( new FlowLayout() );
              //JFrame frame = new JFrame();
              //Panel myPanel = new Panel();
              labelMin = new JLabel("00");
              labelHour = new JLabel("00");
              labelSep1 = new JLabel(":");
              labelSep2 = new JLabel(":");
              labelSec =new JLabel("00");
              button = new JButton("Stop");
              c.add(labelHour);
              c.add(labelSep1);
              c.add(labelMin);
              c.add(labelSep2);
              c.add (labelSec);
              c.add(button);
              //frame.add( myPanel);
              runClock();
              button.addActionListener( new ActionListener() {
                   public void actionPerformed( ActionEvent e) {
                        timer.interrupt();
              //frame.setBackground(Color.blue);
              //frame.set
              Visible(true);
              setSize(200,100);
              setResizable(false);
              show();
         public void paint(Graphics g) {
              secCount += 1;
              labelSec.setText(String.valueOf(secCount));
              if ( Integer.parseInt(labelSec.getText()) >= 60 ) {
                   minCount += 1;
                   labelMin.setText(String.valueOf(minCount));
                   if( Integer.parseInt(labelMin.getText()) >= 60 ) {
                        hourCount += 1;
                        labelHour.setText(String.valueOf(hourCount));
                        minCount = 0;
                      labelMin.setText(String.valueOf(0));
                   labelSec.setText(String.valueOf(0));
                   secCount = 0;
         private void runClock() {
                 timer = new Thread(this);
                 timer.start();
         public void run() {
                 Thread me = Thread.currentThread();
                 while (timer == me) {
                          try {
                              Thread.currentThread().sleep(1000);
                          } catch (InterruptedException e) {
                repaint();
    public static void main (String args[]) {
         timer app = new timer();
         app.addWindowListener( new WindowAdapter() {
              public void windowClosing( WindowEvent e) {
                   System.exit(0);
    }When the window is moved , the timer "speeds up" !!!!
    Does anyone have a solution to this problem???
    Thankx in advance...

    Hi.
    Please copy/Paste the following code
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.text.*;
    import java.util.*;
    public class timer extends JFrame implements
    Runnable{
    Frame frame;
    Thread timer;
    private JLabel labelSec, labelMin, labelHour,
    labelSep1,labelSep2;
    private JButton button;
    private int secCount =0, minCount =0, hourCount=0;
    SimpleDateFormat formatter ;
    Date currentDate;
    timer() {
    super("Timer!");
    Container c = getContentPane();
    c.setLayout( new FlowLayout() );
    //JFrame frame = new JFrame();
    //Panel myPanel = new Panel();
    labelMin = new JLabel("00");
    labelHour = new JLabel("00");
    labelSep1 = new JLabel(":");
    labelSep2 = new JLabel(":");
    labelSec =new JLabel("00");
    button = new JButton("Stop");
    c.add(labelHour);
    c.add(labelSep1);
    c.add(labelMin);
    c.add(labelSep2);
    c.add (labelSec);
    c.add(button);
    //frame.add( myPanel);
    runClock();
    button.addActionListener( new ActionListener() {
    public void actionPerformed( ActionEvent e) {
    timer.interrupt();
    //frame.setBackground(Color.blue);
    //frame.set
    Visible(true);
    setSize(200,100);
    setResizable(false);
    show();
    public void paint(Graphics g) {
    secCount += 1;
    labelSec.setText(String.valueOf(secCount));
    if ( Integer.parseInt(labelSec.getText()) >= 60 ) {
    minCount += 1;
    labelMin.setText(String.valueOf(minCount));
    if( Integer.parseInt(labelMin.getText()) >= 60 ) {
    hourCount += 1;
    labelHour.setText(String.valueOf(hourCount));
    minCount = 0;
    labelMin.setText(String.valueOf(0));
    labelSec.setText(String.valueOf(0));
    secCount = 0;
    private void runClock() {
    timer = new Thread(this);
    timer.start();
    public void run() {
    Thread me = Thread.currentThread();
    while (timer == me) {
    try {
    Thread.currentThread().sleep(1000);
    } catch (InterruptedException e) {
    repaint();
    public static void main (String args[]) {
    timer app = new timer();
    app.addWindowListener( new WindowAdapter() {
    public void windowClosing( WindowEvent e) {
    System.exit(0);
    }When the window is moved , the timer "speeds up" !!!!
    Does anyone have a solution to this problem???
    Thankx in advance...The behaviour is not strange, specially when you increment a counter in a method which is the trigger action for paint events.

  • Running Swing on OS X makes buttons/dropdowns look strange

    Hi all,
    Today I ran our Swing application which currently uses XPLookAndFeel under Windows and ran it on OS X 10.4 with Java 1.5.0_6 and it runs fine and all except that buttons and dropdowns have this weird whitestrip beside them. i.e. the background for them is not completely gray. So my Java code is still making a call to XPLookAndFeel which sets some button and background colors. The fonts are different as well so I'm wondering what I can do to fix it. the description may be vague but please ask if you need to know anything.
    Thanks

    Yes. In the Main.java in the beginning I set it to XPLookAndFeel and set some colours. I changed it to native Aqua but it looked all whacked (buttons too big, dropdowns too small, etc.)
    this one almost everything looks ok except the buttons, dropdowns colours look shifted to the right.

  • Swing and IE proxy

    We have done a small GUI using NetBeans 6 . However it has a strange behaviour which we are not able to over come. With this GUI application , it has tried to load IE proxy SOCKS settings whenever it connects to a remote sql server (JDBC) . And it is not getting through
    When we disable the proxy or whitelist the sql server host name, we can get through.
    My questions is , how can we bypass this loading of IE proxy? Is it caused by Swing ? We did another simple console program, loading the same driver connecting to the sql server, it doesn't load IE proxy settings at all.
    What are we missing?

    Same issue here. Seems to be a bug with the way netbeans uses the system proxy settings. This needs to be filed with netbeans, and I'll post a work-around if I find one.
    -Tres
    If your (Netbeans) Java application cannot connect, try explicitly adding your exception instead of using wildcards, due to bug 125588 http://www.netbeans.org/issues/show_bug.cgi?id=125588
    Claims to be fixed for future Netbeans releases.
    -Tres
    Edited by: FBL on Apr 28, 2008 11:28 AM

  • Problem with "find" mode in adf/swing application

    Hi all,
    I'm working on ADF Swing application which uses MS SQL Server 2005 (JDeveloper 10g 10.1.3)
    I think that my issue might be well-known…sorry if it has been already discussed somewhere else…
    I have a problem with the “find” mode for a detail panel in a master-detail form…(To make it clear the “find” mode is switched on when clicking on the special button on a navigation panel).
    So this mode works well in a master panel, but it demonstrates strange behavior on a detail panel, i.e. it takes me two attempts to find the necessary child object and it doesn’t switch back in a simple way from this mode to the normal mode….say if we are in the department 10 (Dept is a master form) we can’t simply find KING employee (Emp is a detail form)…is there any workaround for this?
    Thanks in advance. Alex.

    Hi Frank, please look this issue

  • Threading Network code in a Swing Application

    For my final High school project i have decided to code a Poker game to be played over the network. Problem is, as soon the host starts waiting for a client to connect, everything Swing related freezes. A friend of mine said to use Threads.
    Strangely enough, when i made a small example class, this did not happen.
    Any e-books,ideas examples about threading please?or a solution to this 'freeze' problem?
    Message was edited by:
    Naks

    There is a ton of stuff in these forums and elsewhere on usage of SwingWorker. It may be helpful to google this and also open the Sun tutorials on concurrency and Swing, and study the the articles.
    Good luck!
    /Pete

  • How to set up Email in S60v3/5/^3 and bypass the N...

    There are many threads on this board that all say the same thing and usually are about how Nokia Messaging or email is not working or syncing.
    In an effort to have a base-line to assist with these, I have made the following tutorial to help users to bypass the Nokia Messaging (NM) as it is the auto-default to set up email on Nokia devices.
    NM allows for “push” email, which will not keep you constantly online and will allow for marking your server email with what you have on your device.  Ie-if it is read on the device, it will be marked as read on the server, deleted, then deleted, etc. 
    When you bypass the NM, you will lose the “push” but you can setup most email as an IMAP4 which will do the same thing, and you can select what folders to sync, and how often to have them sync, not keeping you online.
    This tutorial was done on a Symbian s60v5 device, and while some of the dialog may be different among devices, the process is relatively the same when bypassing NM.
    Open the email client, select options
    Select Settings
    Select E-mail
    Select Mailboxes
    Options
    New mailbox
    E-mal wizard will show up, tap Start
    Next screen, Preparing for installation:
    If asked, allow to use network.  It will default to network to allow for set-up of NM.
    If first time setting up email, this screen will show, “Welcome to E-mail setup”  after you have done it once, it may not show up.  Tap Start.
    Enter E-mail address, then tap OK
    Splash screen
    Enter Password, then tap Ok.
    Splash screen
    This is the screen where you can choose between the NM and the internal email client.  Aka, Terms of Service (on some devices you have to “agree”) (aka-TOS).  The default  is Yes! Activate my Nokia Messaging account, and if you have already set one up, it will say, “Add to my Nokia Messaging account.
    You need to select “No Thanks.  I’ll check for new messages manually.” Or “Create a separate account that uses manual delivery.
    Splash screen
    Confirmation screen. Select Ok.
    Your new mailbox may not show up in the next screen which is supposed to show all the mailboxes set up.  It is a slight glitch in some phones.  Just tap the back button and then mailboxes, then you should see it set-up in the mailboxes as shown.  Highlight your new mailbox and then select options to setup the settings of the email address. 
    You will need your inbound and outbound server settings and ports and securities if needed.  You should be able to google for the various email types and if it is a company email, you should be able to get this information from your system admins.
    The following are just some screen shots so that you can see the process to follow.  While the NM will sync and mark messages as read the same in the inbox, if you set up your email as an IMAP4, it will do the same and sync all the folders on the server as well.  There is an option to for how frequent you would like your email to auto-sync, just as with the NM.  AND what days you would like it to work!
    As there are older, the same, and newer versions of the Symbian and NM, this should help many people as least have the right guidance to bypass it if they wish and get on with consistent email service without using the NM.

    I managed to set up an account manually on the C7 but I had to trick the email application by entering an invalid email address and password. After it could not find my account it then opened up all the settings and permitted me to add the manual IMAP settings, reply to address and other details. After I committed the settings, the phone recognised the account as a gmail account and it locked down all the settings again so I could not go back and change them if wrong. 
    I was quite chuffed with myself for seemingly resolving all my issues.....but on using the new account settings I could not sync the gmail sent / bin folders. All the other folders synchronised fine and when I send email it has the correct reply to address. Strangely this matches the best results I obtained when connecting using the Mail for Exchange settings so am no further forward. I am a little confused by this as when I let the phone set up the Gmail account on it's own it can sync everything.....but I just can't 
    I am now hoping that the new software update (PR1.2) gets email working a little better....well when I eventually get it hehe.

  • Short code causes a strange problem - About the list again -- please read!

    Hi again people. Maybe you remember my project - has a list, that you can search thru using a text field. During the work I got stuck on a strange problem ( Again :-( ) My app has one text field, one combo box, one list and a text field once more. The code should do the following ->
    *1. Load the list, no problem with that.*
    *2. Show the elements of the list, that match the selected group in the combo box,no problem.*
    *3. Search thru the list using the text field,no problem.*
    4. When the user selects an element from the list, it should display its info in the second text field. This also works fine, but when after looking at info of one of the elements the things on numbers 2 and 3 ( look up! ) stop working. I must say that everything works fine until user selects an element from the list. I couldnt understand this kind of behavior so I am asking you to help me please.
    The code is very simple:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    class the_window extends JFrame implements DocumentListener, ItemListener, ListSelectionListener {
        FileReader reader;
        String data_base[][];
        String first_pass[];
        int number_of_elements;
        DefaultListModel dflm = new DefaultListModel();
        JList list;
        JTextField text_field = new JTextField();
        JTextField info_field = new JTextField();
        String groups[] = {"1. group" , "2. group"};
        JComboBox groups_cmbx = new JComboBox(groups);
        the_window(){
            super("the Window!");
            JPanel panel = new JPanel(null);
            Container c = this.getContentPane();
            c.add(panel);
            text_field.setBounds(10,10,170,25);
            text_field.getDocument().addDocumentListener(this);
            panel.add(text_field);
            groups_cmbx.setBounds(10,45,170,25);
            groups_cmbx.addItemListener(this);
            panel.add(groups_cmbx);
            list = new JList(dflm);
            list.setBounds(10,90,170,190);
            list.setFixedCellHeight(20);
            list.addListSelectionListener(this);
            panel.add(list);
            info_field.setBounds(10,280,170,25);
            panel.add(info_field);
            load_the_base();
            refresh();
            this.setSize(190,350);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setResizable(false);
            this.setVisible(true);
        public void itemStateChanged(ItemEvent e){
            refresh();
        public void valueChanged(ListSelectionEvent e){
            String str = (String) dflm.getElementAt(list.getSelectedIndex());
            int index = 0;
            for(int i = 0; i < number_of_elements; i++){
                if(str.equals(data_base[0])){
    index = i;
    break;
    info_field.setText(data_base[index][1]);
    private void load_the_base(){
    String data = "";
    try{
    reader = new FileReader("data.txt";);
    int r = 0;
    while((r = reader.read()) != -1){
    char c = (char) r;
    data += c;
    reader.close();
    }catch(IOException e){}
    first_pass = data.split(";");
    number_of_elements = first_pass.length;
    data_base = new String[number_of_elements][];
    for(int i = 0; i<number_of_elements; i++){
    data_base[i] = first_pass[i].split("#");
    private void refresh(){
    String search_str = text_field.getText();
    int selektovano = groups_cmbx.getSelectedIndex();
    dflm.clear();
    for(int i = 0; i < number_of_elements; i++){
    int grupa = Integer.parseInt(data_base[i][2]);
    if(grupa == selektovano){
    String at_the_moment = data_base[i][0]; // if you change this to String at_the_moment = data_base[i][1]; it works perfectly
    if(at_the_moment.startsWith(search_str)){
    dflm.addElement(at_the_moment);
    public void changedUpdate(DocumentEvent e){
    refresh();
    public void removeUpdate(DocumentEvent e){
    refresh();
    public void insertUpdate(DocumentEvent e){
    refresh();
    public class Main {
    public static void main(String[] args) {
    JFrame f = new the_window();
    Now, can you please tell me whats wrong with this?
    For the "data.txt" make a new text file using *notepad* and copy the following line into the document:
    _1. element#1. info#0;2. element#2. info#0;3. element#3. info#1;4. element#4. info#1;5. element#5. info#1;_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Darryl.Burke wrote:
    Keith, thanks for making that readable. So here's the diagnosis -
    In the refresh() method, calling defaultListModel.clear() results in a valueChanged(...) event in which this method calldefaultListModel.getElementAt(list.getSelectedIndex())results in the exception noted, as getSelectedIndex returns -1, the list being empty... you can't getElementAt(-1).
    I haven't analyzed all the code nor checked whether is now works as desired, but this small change to valueChanged counters the exception being thrown.   public void valueChanged(ListSelectionEvent e) {
    infoField.setText(""); // do this unconditionally
    if (list.getSelectedIndex() != -1) {
    String value = (String)defaultListModel.getElementAt(list.getSelectedIndex());
    for(int i = 0; i < numFields; i++){
    if(value.equals(matrix[0])){
    infoField.setText(matrix[i][1]);
    break;
    db
    Yea! You were right! I didnt think that calling *list_model.clear();* will result in calling *valueChanged()* ........
    That was some *clear()* thinking :-) Thank you!
    corlettk wrote:
    I cleaned up some variable & method names (tut tut), imports (very naighty), and some thread stuff... but it remains fundamentally the same codeIs it so important to "clean" the imports? How much does it slow down the loading time? Should I do this on all my projects, because they are all "very naighty"?
    ps. Thanks to all that gave some help to answering this strange question :-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Bit of a strange question regarding security and internet connection

    This is a bit of an odd question so bear with me for a moment.
    I sold my old G4 to someone I didn't know yesterday. While he was looking at it to make sure it was working I allowed him to plug my ethernet cable in (connected to both a netgear router and a cable modem) and go online to install an application on the computer he was buying. It did't take long and I didn't actually see what he installed but after he left and I plugged back in to my mac pro, my internet connection started suffering. It started by being very slow and then timing out with servers. I reset the modem and even bypassed the router but the connection did not improve and eventually I could only get a self assigned IP address with no internet, although the modem appeared to be fine.
    Aside from finding my I.P. address at my location, is there anything else he could have compomised security wise, either in the name of harvesting some kind of info or just creating a problem in the cable network when I let him use my connection on the g4?
    I think that most likely I'm being a little paranoid but the timing of this is a bit strange. It literally went down hill just after he left.
    Today the cable company is reporting a wider internet outage than just me but I just though I'd throw it out there to see if there are any security wholes exploitable when someone uses your internet connection (I would think and hope that there are not).
    thanks a bunch

    Well, in the closing the stable door approach it is a good idea to do a complete erase and install when selling any computer. There's lots of references to this and even one about removing a certain file so when they start up they get the brand new Mac greeting window. If you do not erase the drive using the secure erase feature in Disk Utility then with an $80 investment plus an empty spare drive the purchaser can likely recover any files you had on the computer recently if they consider it worth the effort.
    I suspect the internet issue is not related to this, especially since your ISP commented about problems.

Maybe you are looking for