What is the event handler in Java (using net beans, Swing) that resembles the Paint in C#?
The event which shall be fired when the form is restored, resized ... etc
public void paint(Graphics g2){
g2 = pnlDrawing.getGraphics();
g2.clearRect(0, 0, size, size);
g2.setColor(Color.BLACK);
g2.fillRect(size/2-1, 0, 2, size); /...
How to modify/add code to the initComponents() method in Java on Net Beans? When I try to add any line of code this area seems to be like read only and it's highlighted in gray! It's for security probably, but I suppose there is a way to disable that.
...
So suppose I'm developing a chess-like program using Java's Swing. I added a MouseListener to handle user input. To make a move the user must click a valid piece and then click a valid place. What's the best way to track the 2 mouse clicks in a turn? I'm thinking in use some kind of variable to record if is the turn's first click or seco...
I have a Graphics object of JPanel and that is working fine:
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import javax.swing.JPanel;
public class GraphicsTest extends JPanel
{
private Graphics2D g2d;
private String state;
private int x, y;
@Override
...
Hello, I cannot put jChceckBox to jTable cell. More likely I can put checkBox to table, but when I run module with that table, the cell where should be checkBox shows text "true" or "false". The behaviors of that cell are the same like checkbox, but it shows text value instead of checkbox.
Here is the code.
DefaultTableModel dm = new D...
I created class NewProject extends JInternalFrame. Then I create New...Action named "NEW", localised in File menu. I put code NewProject p = new NewProject(); p.setVisible(true); to the ActionPerformed method of the action.
But when I run the module and click "NEW" in file menu, nothing appears.
Where can be problem?
EDIT:
I partially...
I am scrapping data from web site using my java application and want to display the result after parsing code of html page in a Text Area made in Swing.
Text like: hello <b>every</b>one should be displayed as: 'hello everyone' in text area.
Thanks!!
...
Hello,
I want to have a JEditorPane inside a JScrollPane. When the user clicks a button, the click listener will create a textEditor, call jscrollpane.setViewPort(textEditor), call textEditor.setText(String) to fill it with editable text, and call jscrollpane.getVerticalScrollBar().setValue(0). In case you're wondering, yes, the setTe...
Hello, I need to create something like internal frame in netbeans platform, which loads file from any location.
I tried it by jInternalFrame, but I was not able to find some container to which I can add my frame. I am working in netbeans platform, which has own pre-created main window.
Pease help me by any advice, I am dealing with this...
I need to make some textFields and other in it and implement some logic. Is it possible?
...
I have an empty JTable, absolutely nothing in it. I need to dynamically generate its table columns in a certain way. A simplified version for the code I have for my attempt:
@Action
public void AddCol() {
for (int i = 0; i < 10; i++) {
TableColumn c = new TableColumn(i);
c.setHeaderValue(getColNam(i));
table....
Hello, I need create custom dialog and put JPanel into it. Is it possible?
...
So I made a standard swing application in Netbeans 6.8 but I can't find where the resource file that defines the localized string for the Exit menu item under File.
It doesn't seem to be defined among the resource files in <project>/resources. Is this a standard string somewhere or am I missing something?
...
I am using Nimbus Look and feel. I needs to change the Background color and foreground color of the tab in JTabbedPane but the color doesn't set in JTabbedPane. I tried setForeground(), setForegroundAt(), setBackground() and setBackgroundAt() methods but it isnt works.This is my code
public class TabbedPaneDemo extends JFrame
{
Tab...
Hi I have cretaed my own renderer. I want the back ground should be blue. I have set background color as blue also. But I donot know what is tha problem that the background color of my renderer always seems to be white.
I have post the code. please help where I am wrong so that the background color becomes white.
class CheckTreeCellRen...
I have created a divider in JSplitPane. I am unable to set the color of divider. I want to set the color of divider. Please help me how to set color of that divider.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class SplitPaneDemo {
JFrame frame;
JPanel left, right;
JSplitPane pane;
int last...
Maybe it's not worth worrying about in this scenario, but lets say you have two classes, a JFrame with all its components, and a server-like class that handles requests from remote clients. The user is able to start and stop server objects through the GUI, and is shown various events that happen to each server object. Whether or not I us...
I have 4 checkboxes added as a group so that I will be able to select only one checkbox.
But if I select one of them and now want to uncheck all of them in a group, I am unable to do that. Any one has idea how can I do that?
...
I have written a program with flow layout, in Java, using Swing Framework. How do I change it to use group layout?
...
hi, simple question :
I need to write cross platform application (basically CRUD).
Is usage of Java Swing good idea? Or is it out-dated and you know better solution?
I dont want to use like 5 languages for various stuff, one or two should be enough.
Thanx!
...