Showing posts with label NetBeans. Show all posts
Showing posts with label NetBeans. Show all posts

Thursday, January 2, 2014

Java Desktop Applicaiotn in Netbeans: To open a JFrame by clicking a button of another

Double click the specific button in the add the Event Listener on Click Event (ActionListener) 
 
 
public void actionPerformed(ActionEvent e) {
        //  this.setVisible(false);
        this.dispose();
        new FrmMain().setVisible(true); // Main Form to show after the Login Form..
    }

Java Desktop Application using Netebans: How to position the form in the center screen?

In design mode:
select your JFrame(on Design mode), and then go to  Properties, Bindings,Events, Code. 
We need "Code" and set properties Generate Center (true) that's all. 


--
Another way through code:
 
JFrame frame = new JFrame("FooRendererTest");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.getContentPane().add(mainPanel); // or whatever...
  frame.pack();
  frame.setLocationRelativeTo(null);  // *** this will center your app ***
  frame.setVisible(true);

Tuesday, October 1, 2013

How to Get CodeIgniter Support for PHP in NetBeans?

To supports CodeIgniter in my favourite IDE Netbeans there is a NetBeans plugin under the Project Kenai
This plugin will allow us to create CodeIgniter projects right from NetBeans’ Create New PHP Project Wizard, also it’ll provide full auto-completion while you’re coding.
In this post I’ll explain how to get this plugin to work. First you should make sure that you have at least NetBeans 7.0 installed on your machine. Also go ahead and download the latest version of CodeIgniter (currently v 2.1.4).
1. From NetBeans go to Tools menu, then choose Plugins, and then select the Settings tab.
2. Click on the Add button on the window appeared from the last step.
3. Type any name you find appropriate, and for the URL paste one of these links depending on your NetBeans version, and click Ok.
4. Go to the Available Plugins tab, and search for CodeIgniter, two plugins should appear (Framework and Framework Repository), check both of them and click Install.
5. Go to Tools menu, and choose Settings. Then go to PHP tab. You should find a new tab for CodeIgniter, switch to it.
6. Under Base Files click Add type an appropriate name in the name field (I used CodeIgniter 2.1.4), and browse to the CodeIgniter’s zip file you downloaded earlier. Finally hit the Ok button.
7. Now restart NetBeans, and once it’s restarted try to create a new PHP project via the File menu.
8. Go through the few steps of creating a new project, and at the final step under PHP Frameworks you should find CodeIgniter there, check it and hit Finish.
Create New PHP Project Wizard

There you have it! You can now start coding with CodeIgniter like a ninja!

Wednesday, September 18, 2013

To show Image in jasper report from BLOB field of MySql Database

Normally we save image in the blob field of mySql database table. To get that image  in the report page of jasper report we need to follow some steps.

1.set your field class type:    java.io.InputStream
2.Write Image Expression :     JRImageLoader.loadImage((byte [ ] )
                               (JRLoader.loadBytes($F{ImageData})))
                                ImageData is the Blob field in the table.
3.Image Expression Class :      java.awt.Image
4.add the following include

  
 

Thursday, February 23, 2012

Setting Maximum no. of characters in jTextField for Swing Application

Sometimes we need to fixed the maximum size of a text field. For this purpose, we need to implement a document containing an overriding function of plain document.

public class MaxLengthTextDocument extends PlainDocument {

private int maxChars;

@Override
public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
if(str != null && (getLength() + str.length() < getMaxChars())){ super.insertString(offs, str, a); } } /** * @return the maxChars */ public int getMaxChars() { return maxChars; } /** * @param maxChars the maxChars to set */ public void setMaxChars(int maxChars) { this.maxChars = maxChars; } }



after that we will have to set the following line after initComponents() of view file.


MaxLengthTextDocument maxLength = new MaxLengthTextDocument();
maxLength.setMaxChars(12);//50 is a maximum number of character
this.txtMobileNo.setDocument(maxLength);

Monday, October 17, 2011

Adding new datasource to iReport in Netbeans

iReport is an important tools for reporting in java applications. In Netbeans, we may face problem to add new data source for iReport. Here is the step by step procedure to add a database driver for iReport. 1) go to "Tools / Options" menu and select iReport 2) verify that database JDBC driver is present: - Choose "Classpath" tab - Click "Add JAR" and then locate the desired (mysql.jdbc).Driver - Click "OK" 3) click "Connections / Datasources" icon in toolbar 4) click "New" and set up a "Database JDBC Connection" using driver from step 2 5) click "Test" to verify the data source works correctly 6) click "Save" to save the data source

Friday, June 10, 2011

Installation of Netbeans 7 in Ubuntu

Its really easy to install................

Step 1: Copy the Netbeans 7 for Linux(netbeans-7.0-ml-linux.sh) and JDK foo Linux(java_ee_sdk-6u1-jdk-linux.sh) into the desired location.

Step 2: Open the terminal from(Application-->Accessories--> Terminal)

Step 3: Using Command, navigate to the location of two files. Its better to keep both of the files in the Home folder of you, as its the default location. To check the availabilty of the files you can use the command

ls -l

It will shows the list of the files at that location.



Step 4: Then try to install the jdk file using the command

sh jdk-6u21-linux-i586.bin

Step 5: The to install Netbeans, at first make the file executable using the command

sudo chmod +x netbeans-*

Step 6: Then use the command, to install netbeans as

sudo ./netbeans-* --javahome jdk1.6.0_21

for me, it was
sudo ./netbeans-* --javahome jdk1.6.0_21

Step 7: The above command will provide the Netbeans installer to navigate your for the further steps to follow.



After installing, to use netbeans You can use it from Applications -> Programming -> NetBeans & from ubuntu menubar. But sometimes it may occurs problem to you(i.e this may not be appeared at the menu). Then you can use it by command prompt using the command

netbeans


to do so you need to run a simple command just for once after:

ln -s /usr/local/netbeans-6.5/bin/netbeans /usr/local/bin/netbeans

Use sudo before each command if you get the access denied message. Then giving correct password, you will be able to do so.(sudo------------> Super Do)

Then the command will be as

sudo ln -s /usr/local/netbeans-7.0/bin/netbeans /usr/local/bin/netbeans


The above command will make a shortcut at bin folder(common).
After that you will get netbeans just by typing it in the terminal. You may aslo create a shortcut launcher to this link.

Now enjoy Netbeans and Ubuntu together.

Plz let me know your experience..