- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
20 Posted Topics
The easiest way will be use the NetBeans IDE and do the same in the Design Area.
Are you looking at code to open the txt file and display the same or reading the file and processing
One of the easiest way would be, if you don't intend to add any components to the main frame [CODE]JLabel lab = new JLabel(new ImageIcon("full file path")); frame.setSize(500,200); frame.add(lab); frame.setVisible(true); frame.setResizable(false);[/CODE] If you want to put the Image to the whole screen then you will have to get the scaled …
I am not sure about SAXBuilder but the below code will work DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance(); DocumentBuilder dB = dBF.newDocumentBuilder(); Document doc = dB.parse(new File(xml File Name)); //Now use Node/NodeList and read the data
Best way is create a Folder lib in your Project and place your project depending Jar files into it and and map the library for compile to the lib folder, ship the project with the lib file.
If its txt file, one of the way is to create a third file with both the data FileInputStream fi = new FileInputStream(File1); BufferedReader br = new BufferedReader(new InputStreamReader(fi)); FileInputStream fi2 = new FileInputStream(File2); BufferedReader br2 = new BufferedReader(new InputStreamReader(fi2)); String strLine; while ((strLine = br.readLine()) != null) { String …
Rt Click the Project Option in Design and select Event > Action > actionPerformed now enter the below code for actionPerformed. [CODE]JFileChooser fileChooser = new JFileChooser("."); fileChooser.setMultiSelectionEnabled(true); fileChooser.setMultiSelectionEnabled(true); int status = fileChooser.showDialog(this, "Import"); if (status == JFileChooser.APPROVE_OPTION) { JOptionPane.showMessageDialog(this, "Done"); }[/CODE]
Create the Vector as Instance or Class Variable.
you need to import the util calender [CODE] import java.util.Calendar;[/CODE]
try the below code [CODE]for (Component comp : mainPanel.getComponents()) { if(comp instanceof JLabel){ mainPanel.remove(comp); }[/CODE]
Your code is messed up Use the below Code inside your For Loop [CODE]JTextField jt = new JTextField(); jt.setSize(new Dimension(30,20)); jt.setText(text); int val =(i+1)*10; jt.setLocation(val, val); sell.add(jt);[/CODE]
First set the model like below [CODE]setModel(new javax.swing.table.DefaultTableModel( new Object[][]{}, new String[]{ "Product", "Price", "Stock", "Code", "Amount Sold" })[/CODE] try the below code to add data to the table [CODE]model = (DefaultTableModel) jTable1.getModel(); ...... Object[] obj = {list[0], list[1], list[2], list[3], list[4]}; model.addRow(obj);[/CODE]
What is that you want to do, just posting the code is of no use
JTextPane will always be inside the JScrollPane, you need to check the JScrollPane and get/set text to the JTextPane. If you can post some code will be more easier to provide help
Did you ever checked your code before posting, change the code as below internalFrame1.setBounds(5, 5, 788, 200); JRadioButton r = new JRadioButton("test"); r.setBounds(50, 50, 50, 20); internalFrame1.add(r); JRadioButton r1 = new JRadioButton("test1"); r1.setBounds(80,80,60,20); internalFrame1.add(r1); internalFrame1.getContentPane().add(b1); internalFrame1.setVisible(true); internalFrame1.setBackground(Color.RED); JPanel panel1 = new JPanel(); panel1.setBackground(Color.red); panel1.setForeground(Color.BLACK); panel1.setLayout(null); panel1.add(internalFrame1); JDesktopPane dtp = new …
One of the way to do is JLabel lab = new JLabel("Checking"); lab.setPreferredSize(new Dimension(200,40)); jTabbedPane1.setTabComponentAt(0, lab);
One of the way is String text = jTextPane1.getText(); text = text.substring(0,jTextPane1.getCaretPosition())+" "+ jTextField1.getText() + " " +text.substring(jTextPane1.getCaretPosition()); jTextPane1.setText(text);
If your GUI exceeds the Display support you can do following. 1.Put inside ScrollPane > which you can scroll even if the screen is smaller. 2.Design the GUI for lower resolution and resize the frame when screen size is bigger.
If you just want to display the PPT or ODT file using the default application installed in windows then use the following command File dest = new File("fileLocation\\fileName" + ".odp or .ppt"); Desktop.Action act; act = Desktop.Action.OPEN; Desktop desktop = Desktop.getDesktop(); desktop.open(dest);
The End.
vealparry