Question about Microsoft Internet Explorer 7

1 Answer

About java swing..

How to make java program using swing?

Posted by on

1 Answer

  • Level 1:

    An expert who has achieved level 1.

    Mayor:

    An expert whose answer got voted for 2 times.

    Problem Solver:

    An expert who has answered 5 questions.

  • Contributor
  • 2 Answers

Hi, if you have a specific query about java Swing, I can try to help you. Please find a small java code with using swing as example.

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JToolBar;
public class ToolbarDemo extends JFrame {
public static final String FontNames[] = { "Serif", "SansSerif", "Courier" };
protected Font fonts[];
protected JMenuItem[] fontMenus;
protected JToolBar toolBar;
public ToolbarDemo() {
super("Toolbars & actions");
setSize(450, 350);
JMenuBar menuBar = createMenuBar();
setJMenuBar(menuBar);
setVisible(true);
}
protected JMenuBar createMenuBar() {
final JMenuBar menuBar = new JMenuBar();
JMenu mFile = new JMenu("File");
ImageIcon iconNew = new ImageIcon("file_new.gif");
Action actionNew = new AbstractAction("New", iconNew) {
public void actionPerformed(ActionEvent e) {
System.out.println("new action");
}
};
JMenuItem item = mFile.add(actionNew);
mFile.add(item);
menuBar.add(mFile);
toolBar = new JToolBar();
JButton saveButton = new JButton("Save");
toolBar.add(saveButton);

getContentPane().add(toolBar, BorderLayout.NORTH);
return menuBar;
}
public static void main(String argv[]) {
new ToolbarDemo();
}
}
Thanks and Regards,
Supa.

Posted on Mar 18, 2009

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Wirte a pogram in java using for loop,that will print out the first 1 numbers of a fibonacii series that is:1 1 2 3 5 13 21 34 55


package com.gpt;

import javax.swing.JOptionPane;

/*
This program computes Fibonacci numbers using a recursive
method.
*/
public class Fibonacci
{
public static void main(String[] args)
{
String input = JOptionPane.showInputDialog("Enter n: ");
int n = Integer.parseInt(input);

for (int i = 1; i {
int f = fib(i);
System.out.println("fib(" + i + ") = " + f);
}
System.exit(0);

}

/**
Computes a Fibonacci number.
@param n an integer
@return the nth Fibonacci number
*/
public static int fib(int n)
{
if (n return 1;
else
return fib(n - 1) + fib(n - 2);
}
}

Feb 24, 2011 | Sun Java Programming Language (cdj-275)

1 Answer

How to convert a Java Desktop application to Web-based?


1. No, it will take lots of code changes
2. Maybe
3. That depends on what its functions are
4. You may not have to convert it at all
5. Maybe, that's your choice

Oct 22, 2009 | Sun Computers & Internet

1 Answer

Java coding to deduct virus


visual basic 6.0 plese example timer uses

Mar 25, 2009 | Microsoft Windows Vista Ultimate Edition

2 Answers

I want to know how various forms are interconnected


Here is an example of HTML And Javascript:

<HTML>
<HEADER>
<TITLE>Welcome To My Webpage</TITLE>
</HEADER>
<BODY>
<P><B><H1><U>Welcome To My Webpage</B><H1></U></P>
<script:"type/javascript">
alert("Welcome To My Webpage!");
</script>
</BODY>
</HTML>

Mar 22, 2009 | Sun Java Programming Language (cdj-275)

1 Answer

Table creation via textfields using swings


import java.lang.Object;
import javax.swing.table.DefaultTableModel;


public class tabletest extends javax.swing.JFrame {
String[][] row = null;
String[] title=new String[3];
private int i;


/** Creates new form tabletest */
public tabletest() {
initComponents();
setTitle("table test");
setVisible(true);
System.out.print("NO Database Needed");
title[0]="Name";
title[1]="Desig";
title[2]="id";
}


/*
" In middle of this two source one generated code will be there that will be done by dragging ur fields to ur frame. THIS IS FOR netbeans IDE "
*/

private void b1ActionPerformed(java.awt.event.ActionEvent evt) {
row=new String[4][3];
// TODO add your handling code here:

String s1=t1.getText();
System.out.println(" event 1");
String s2=t2.getText();
System.out.println(" event 2");
int k=Integer.parseInt(t3.getText());
String s3=""+k;
System.out.println(" event 3");
try{
// for(int i=0;i<=2;i++)
row[i][0]=s1;
row[i][1]=s2;
row[i][2]=s3;
i++;

}catch(Exception e){
e.printStackTrace();

}
table.setModel(new DefaultTableModel(row,title));
}

private void b2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

t1.setText("");
t2.setText("");
t3.setText("");

}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new tabletest().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JButton b1;
private javax.swing.JButton b2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel l1;
private javax.swing.JLabel l2;
private javax.swing.JLabel l3;
private javax.swing.JPanel p2;
private javax.swing.JScrollPane scp1;
private javax.swing.JTextField t1;
private javax.swing.JTextField t2;
private javax.swing.JTextField t3;
private javax.swing.JTable table;
// End of variables declaration

}

Mar 13, 2009 | Computers & Internet

1 Answer

What is swing components?


Swing is java library that provides basic GUI controls [also called widgets like buttons, checkboxes, labels, menus, etc.. You can use it to create a interactive application with nice interface.

More info here http://en.wikipedia.org/wiki/Swing_(Java)

Mar 10, 2009 | Sun Computers & Internet

2 Answers

Java project (core and advanced)


Hi I am Nitin Daharwal .. If you want make project in Java using Swing only. You may opt for these options 1. Java Image Viwer 2. Exam Simulator 3. Bulk E mail 4. Snake Game 5. Chatting Client 6.Inventory Mangement System you can mail at nitin.daharwal@gmail.com for any help ..

Happy Programming!!!

Sep 25, 2008 | Microsoft Windows XP Professional

3 Answers

Java mini projects


Normaly using Searching Result moduls develop by OS

in this concept by using the own coding in JAVA Applet Programming with Swing using.

Apr 10, 2008 | Monte Carlo 5KC48JG Java Rattan / Grecian...

Not finding what you are looking for?
Microsoft Internet Explorer 7 Logo

Related Topics:

162 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Computers & Internet Experts

micky dee

Level 3 Expert

2642 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18354 Answers

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

Are you a Microsoft Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...