Pages

Showing posts with label Netbeans. Show all posts
Showing posts with label Netbeans. Show all posts

Sunday, August 22, 2010

How to remove events not used in NETBEANS

You might want to remove some events that are not used anymore in your NetBeans file project. You cannot just delete it from the code editor because NetBeans lock it, indicated by the gray color of the line of codes.
Here's how to remove those unused codes:

1. Go to the GUI builder, the Design view of your file.
2. Right click and select Properties. The default open tab is the Properties list. Select the Events tab.

3. You would see events list and what handlers these events are associated.

4. Choose the event you'd like to delete by selecting the [...] button.



5. A new dialog will pop up. Select the handler then click Remove button.

Thursday, July 15, 2010

How to disable edit cell in JTable (especially in NetBeans)

Put this in your code:

table = new javax.swing.JTable(){
    public boolean isCellEditable(int rowIndex, int colIndex) {
        return false;   //Disallow the editing of any cell
    }
};

where table is the name of your JTable.

For NetBeans users:
1. select the table GUI, right click, select Customize Code
2. Your code should look like this:

Friday, May 14, 2010

How to remove JTextArea line around rectangle (border)

 code:

textarea.setBorder(null);

In NetBeans:
1. Click the text area
2. Go to Properties
3. Scroll to Other Properties
4. Go to border then select (No Border)
5. Put this in your constructor:
jScrollPane1.setBorder(null);
This is because NetBeans automatically creates scrollpane to your text area and its border is visible until you set it to null.
6. Run the file to see the result.
It worked for me just fine :)

Tuesday, February 9, 2010

My TOP 2 Netbeans IDE 6.7.1 Annoyance

1. When I type JOptionPane then hit the period "." key the available attributes should appear but as I type JOptionPane.showConfirmDialog and put 4 parameters, the last parameter won't auto complete anymore. I am supposed to put JOptionPane.YES_NO_OPTION, now I have to type every letter of it. So annoying for me.

2. The codes won't 'refresh' right away. Sometimes I have to run my program 3 times for my changes in the code to take effect. Soooo annoying.

Monday, November 23, 2009

How to Add Formatted Text Field in Netbeans: Limit the Input in Java Text Field

---

Formatted text field is a feature in Java programming that lets you control the input in your JTextFields.

In Netbeans IDE, you cannot just edit the codes anywhere you like it if the GUI is generated by the IDE. This may mean that putting your formatting code would take you some time by overriding the class, function, etc (That's how you usually customize Netbeans - generated codes). However, there's a shorter way to do that, follow these steps:


1. Right click on the JFormattedTextField and select Customize Code

click the image for a larger view

2. Code it!

Be sure you get to see the Code Customizer dialog box of Netbeans that look like this:


Note 1: Declare and instantiate the Maskformatter just once.

Note 2: Define the maskformatter. Search the net for ways you could manipulate the MaskFormatter's functions :P

***