8. After you extract it you can see "javac-bin" folder and "javacv-cppjars" folder
OK. Now open neatbeans and make new project
9. Now you have add few libraries
10. Right click on libraries and choose "Add Jar/Folder"
11. Now open the javac-bin folde. Select javacpp.jar,javacv.jar jar files and if you using windows choos javacv-windows-x86.jar and javacv-windows-x86_64.jar files.if you usin another operating system please choose jar file by compareing with your operating system.
12. Select them and click open.
13. Same way go to javacv-cppjars folde and choose jar files with your operating system name.
14. Now simply add a button to jframe. Double click on it and got click event of button
15. Type the following codes
IplImage image=cvLoadImage("C:\\Users\\Udayanga\\Desktop\\Internet\\img.png");
final CanvasFrame canvas= new CanvasFrame("Demo");
canvas.showImage(image);
canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
16. If you see some erro right clic on code area and choose Fix Imports
17. Now run your programm.
By using openCV we can make very interesting applications. Follow is some of them.
Double click on the submenu item and enter following codes
Open
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Text File(*.txt)|*.txt";
if (ofd.ShowDialog() == DialogResult.OK)
{
System.IO.StreamReader sr = new System.IO.StreamReader(ofd.FileName);
GetRichBox().Text = sr.ReadToEnd();
sr.Close();
}
Save
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK)
{
System.IO.StreamWriter sw = new System.IO.StreamWriter(sfd.FileName);
sw.Write(GetRichBox().Text);
sw.Close();
}
Exit
Application.Exit();
Undo
GetRichBox().Undo();
Redo
GetRichBox().Redo();
Cut
GetRichBox().Cut();
Copy
GetRichBox().Copy();
Paste
GetRichBox().Paste();
Select All
GetRichBox().selectAll();
We can add a filter when open and save a text file.
To do this add following code to Open and Save submenus
Open
ofd.Filter="Text File(*.txt)|*.txt";
Save
sfd.Filter="Text Files(*.txt)|*.txt";
You can see when the programm is openning there was no new tabb. To make that we can make a new function by using code we use for New menu. So make a new function and call it when programm is open . Follow the following image guids
Next post I will show you how search a word and highlight them
Last post I show how create the menu and how separate them.
This post I will show you how add image icon to the menus and how make a short cut key for them.
Click on menu item and goto Propeties -> ShortcutKeys
Select the ShortcutKeys to shortcut
Add ShortcutKey for all submenu items as follows
New - Ctrl+N
Open - Ctrl+O
Save - Ctrl+S
Undo - Ctrl+Z
Redo - Ctrl+D
Cut - Ctrl+X
Copy - Ctrl+C
Paste - Ctrl+V
Select All - Ctrl+A
Now let's see how add icon to the menus.
Select the submenu item and goto Propeties -> Image
Click import and choose the image icon
Then select the image and click OK
Add icon to the all menu items
Using following link you can download icons I used hear.
Open Visual studio and make a new Visual C# project. I named it as Notepad
After the project is created, click on the form and go to propeties. Change the Text as Notepad.
Now you can see your form name changed to Form1 as Notepad
Then drag and drop a MenuStrip
Add Menus, File and Edit
Add sub Menus
File
New
Open
Save
Exit
Edit
Undo
Redo
Cut
Copy
Past
Select All
When you adding the menus and submenus, goto propeties -> Text change the name of menus and submenu by adding "&" mark to the front of the name.As a example change New as &New
Reason for this is ,open the notepad in your windows computer press Alt button. You can see it's manus are changing. That mean, the first letter is underlined.
When you press the underlined letter's key by using key board that manu item will working.
So add the & for all the menu and submenu items.
Do not need add & mark front of the Text. If it is there were two items start with same letter you can choose another letter.As a example for the Cut and CopyI use y for Copy
Now you can run your project and check if it is working.
You can add separator to separate the submenu items.
Right click on where you want to add the separator. insert -> Separator
Next time we will see how add images to the menu items and how create a short cut keys to the menu items.
If you want to update your table in many time you can make a method for it. As a example if you update a data in your table you can call that method ontime.
If you make a method named updateTable(), you can use it as "updateTable();" anyware in your programm(only in this frame).
You can add this method in your main class(after initComponents();)your data will show as soon as your programm opening.