Buttons in panel??
i created a panel that has buttons. each button calls something to happen in a canvas. but this error appears.
i did put a setShape on the Canvas so i don't know what's wrong
THE ERROR IS:
C:\WINDOWS\Desktop\WINDOWS\pickdraw\ShapeButtons.java:40: local variable drawArea is accessed from within inner class; needs to be declared final
drawArea.setAction(r);
^
C:\WINDOWS\Desktop\WINDOWS\pickdraw\ShapeButtons.java:40: cannot resolve symbol
symbol : method setAction (int)
location: class PickCanvas
drawArea.setAction(r);
^
C:\WINDOWS\Desktop\WINDOWS\pickdraw\ShapeButtons.java:51: cannot resolve symbol
symbol : method setAction (int)
location: class PickCanvas
drawArea.setAction(o);
^
C:\WINDOWS\Desktop\WINDOWS\pickdraw\ShapeButtons.java:61: cannot resolve symbol
symbol : method setAction (int)
location: class PickCanvas
drawArea.setAction(p);
^
4 errors
THE CODE IS
import java.awt.Graphics.*;
public class ShapeButtons extends Panel implements ItemListener
Checkbox fill = new Checkbox("Filled");
Choice sel;
PickCanvas drawArea;
Button rect, oval, poly, del, clear;
public ShapeButtons(PickCanvas drawArea)
this.drawArea= drawArea;
sel = new Choice();
add(sel);
sel.add("selected");
sel.add("deselected");
rect = new Button( "Rect" );
ActionListener lis1 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setAction(1);
rect.addActionListener( lis1 );
oval = new Button( "Oval" );
ActionListener lis2 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setAction(2);
oval.addActionListener( lis1 );
poly = new Button( "Poly" );
ActionListener lis3 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setAction(3);
poly.addActionListener( lis3 );
del = new Button( "Delete" );
ActionListener lis4 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.delete();
del.addActionListener( lis4 );
clear = new Button( "Clear" );
ActionListener lis5 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.clearCanvas();
clear.addActionListener( lis5 );
add(rect);
add(oval);
add(poly);
add(del);
add(clear);
add(fill);
fill.addItemListener(this);
getSel().addItemListener(this);
getSel().select("deselected");
public Choice getSel()
return sel;
public void setSelected(String s)
getSel().select(s);
public void itemStateChanged(ItemEvent e)
if(e.getItemSelectable() == fill)
drawArea.setFill(fill.getState());
if(getSel().getSelectedItem().equalsIgnoreCase("selected"))
drawArea.setSelect(1);
else if(getSel().getSelectedItem().equalsIgnoreCase("deselected"))
drawArea.setSelect(2);
IN THE CANVAS I DID PUT THIS
public void setShape(int action)
this.action = action;
AND I DECLARED AT THE BEGINNING OF THE CANVAS int action=1;
WHAT'S WRONG WITH THIS PROGRAM??
THANKS FOR ANY HELP
The above code with code tags.
import java.awt.Graphics.*;
public class ShapeButtons extends Panel implements ItemListener
Checkbox fill = new Checkbox("Filled");
Choice sel;
PickCanvas drawArea;
Button rect, oval, poly, del, clear;
public ShapeButtons(PickCanvas drawArea)
this.drawArea= drawArea;
sel = new Choice();
add(sel);
sel.add("selected");
sel.add("deselected");
rect = new Button( "Rect" );
ActionListener lis1 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setAction(1);
rect.addActionListener( lis1 );
oval = new Button( "Oval" );
ActionListener lis2 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setAction(2);
oval.addActionListener( lis1 );
poly = new Button( "Poly" );
ActionListener lis3 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setAction(3);
poly.addActionListener( lis3 );
del = new Button( "Delete" );
ActionListener lis4 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.delete();
del.addActionListener( lis4 );
clear = new Button( "Clear" );
ActionListener lis5 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.clearCanvas();
clear.addActionListener( lis5 );
add(rect);
add(oval);
add(poly);
add(del);
add(clear);
add(fill);
fill.addItemListener(this);
getSel().addItemListener(this);
getSel().select("deselected");
public Choice getSel()
return sel;
public void setSelected(String s)
getSel().select(s);
public void itemStateChanged(ItemEvent e)
if(e.getItemSelectable() == fill)
drawArea.setFill(fill.getState());
if(getSel().getSelectedItem().equalsIgnoreCase("selected"))
drawArea.setSelect(1);
else if(getSel().getSelectedItem().equalsIgnoreCase("deselected"))
drawArea.setSelect(2);
}
Similar Messages
-
How to make a shadow for Button or Panel
Actually I want to show a shadow for Button or Panel.
How can I do it.Hi
Pls try to look for the Forms On-Line Help for how to create an alert...
besides this Video Hope it helps....
Good Luck :)
Regards,
Amatu Allah. -
Buttons in panels that doent work..
hi all.
im currently developing an application where panels are switched on a frame.
each panel has its own actionlistener, and is working.
the problem is that the buttons i create in a panel get a null value when an action event occurs.
you can see the code below. (the problem is visible in the class hoofdmenu)
import java.awt.*;
import java.awt.event.*;
public class Metrio extends Frame implements WindowListener
private Panel vorige;
private hoofdMenu begin;
private Leerling leer;
private Vak vak;
private Rapport rap;
private Gebruiker gebruik;
public static void main(String[] args)
//g=f.getGraphics();
//this.requestFocus();
Metrio metrio = new Metrio();
metrio.show();
public Metrio()
setTitle("cijfer registratie systeem");
setSize(600,600);
setLayout(new FlowLayout());
addWindowListener(this);
begin = new hoofdMenu(this);
leer = new Leerling(this);
vak = new Vak(this);
rap = new Rapport(this);
gebruik = new Gebruiker(this);
setPaneel(0);
//addActionListener(begin);
requestFocus();
public void setPaneel(int paneel)
if(vorige != null)
remove(vorige);
System.out.println(""+vorige+" begin="+begin);
switch(paneel)
case 0 : add(begin); vorige = begin; break;
case 1 : add(leer); vorige = leer; break;
case 2 : add(vak); vorige = vak; break;
case 3 : add(rap); vorige = rap; break;
case 4 : add(gebruik); vorige = gebruik; break;
requestFocus();
repaint();
public void paint(Graphics g)
public void windowOpened(WindowEvent e){}
public void windowClosing(WindowEvent e){System.exit(1);}
public void windowClosed(WindowEvent e){}
public void windowIconified(WindowEvent e){}
public void windowDeiconified(WindowEvent e){}
public void windowActivated(WindowEvent e){}
public void windowDeactivated(WindowEvent e){}
class hoofdMenu extends Panel implements ActionListener
private Metrio f;
//private leerling leer;
private Button l, v, r, g;
public hoofdMenu(Metrio fr)
f=fr;
Button l = new Button("leerling");
add(l);
l.addActionListener(this);
System.out.println("l2 = "+l); // l is full here
Button v = new Button("vak");
add(v);
v.addActionListener(this);
Button r = new Button("rapport");
add(r);
r.addActionListener(this);
Button g = new Button("gebruikers");
add(g);
g.addActionListener(this);
System.out.println("l3 = "+l);
public void actionPerformed(ActionEvent e)
System.out.println("een knop gedrukt!");
System.out.println("e = "+e.getSource());
System.out.println("l = "+l); // l IS NULL HERE?????
if(e.getSource() == l)
System.out.println("ik ben er in!!!");
f.setPaneel(1);
System.out.println("leerling knop gedrukt!");
System.out.println("v = "+v);
if(e.getSource() == v)
f.setPaneel(2);
if(e.getSource() == r)
f.setPaneel(3);
if(e.getSource() == g)
f.setPaneel(4);
class Leerling extends Panel implements ActionListener
private Metrio f;
//private Panel ouder;
private Button b;
public Leerling(Metrio fr)
f=fr;
//this.ouder = ouder;
Button b = new Button("terug leerling");
add(b);
b.addActionListener(this);
public void actionPerformed(ActionEvent e)
f.setPaneel(0);
}thanks in advance,
robertYour (l, v, r, g) buttons are re-declared locally in your hoofdMenu() constructor... that's why they are null-referenced outside of the method. So, your code should read: public hoofdMenu(Metrio fr) {
f=fr;
l = new Button("leerling");
add(l);
l.addActionListener(this);
System.out.println("l2 = "+l); // l is full here
v = new Button("vak");
add(v);
v.addActionListener(this);
r = new Button("rapport");
add(r);
r.addActionListener(this);
g = new Button("gebruikers");
add(g);
g.addActionListener(this);
System.out.println("l3 = "+l);
}Hope this helped,
regards. -
MAC-CS4 minimize button on panel
I cant get minimize button on ScriptUI panel to be active it is always greyed out. the code looks like this
> var myDialog = new Window('palette','myPanel',undefined,{minimizeButton:true, maximizeButton:true});
the documentation seems to say it works, on page 106 of CS4 Tools Guide it says
i minimizeButton When true, the title bar includes a button to minimize
i or iconify the window, if the platform and window type allow it. When
i false, it does not. Default is false for type palette, true for type window.
i Main windows cannot have a minimize button in Mac OS. Not used for
i dialogs.In CS5 panels works in the same way.
Minimize button stil remains disabled.
Someone knows how to solve this problem? -
i created a class that has many buttons and each button calls something on a Canvas.
but i keep getting errors.
THE ERROR ARE
C:\WINDOWS\Desktop\WINDOWS\pickdraw\ShapeButtons.java:36: local variable drawArea is accessed from within inner class; needs to be declared final
drawArea.setShape(1);
^
1 error
THE CODE IS
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.lang.String.*;
import java.awt.Graphics.*;
public class ShapeButtons extends Panel implements ItemListener
Checkbox fill = new Checkbox("Filled");
Choice sel;
PickCanvas drawArea;
Button rect, oval, poly, del, clear;
public ShapeButtons(PickCanvas drawArea)
this.drawArea= drawArea;
sel = new Choice();
add(sel);
sel.add("selected");
sel.add("deselected");
rect = new Button( "Rect" );
ActionListener lis1 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setShape(1);
rect.addActionListener( lis1 );
oval = new Button( "Oval" );
ActionListener lis2 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setShape(2);
oval.addActionListener( lis2 );
poly = new Button( "Poly" );
ActionListener lis3 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setShape(3);
poly.addActionListener( lis3 );
del = new Button( "Delete" );
ActionListener lis4 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.delete();
del.addActionListener( lis4 );
clear = new Button( "Clear" );
ActionListener lis5 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.clearCanvas();
clear.addActionListener( lis5 );
add(rect);
add(oval);
add(poly);
add(del);
add(clear);
add(fill);
fill.addItemListener(this);
getSel().addItemListener(this);
getSel().select("deselected");
public Choice getSel()
return sel;
public void setSelected(String s)
getSel().select(s);
public void itemStateChanged(ItemEvent e)
if(e.getItemSelectable() == fill)
drawArea.setFill(fill.getState());
if(getSel().getSelectedItem().equalsIgnoreCase("selected"))
drawArea.setSelect(1);
else if(getSel().getSelectedItem().equalsIgnoreCase ("deselected"))
drawArea.setSelect(2);
IN THE PICKCANVAS I DO HAVE A METHOD WHICH IS:
public void setShape(int action)
this.action = action;
AND I DECLARED ACTION IN THIS CANVAS AS int action;
SO I DON'T KNOW WHAT'S WRONG. HELP.drawArea is defined as a member variable of ShapeButtons, so normally it should be usable from an anonymous inner class as you are trying to use it. However, you have named a parameter of the constructor with the same name as the member variable. This means that when you use that variable name, you are referring to the local variable. If local variables are not final, then they cannot be used in inner classes defined within that function. You have three options:
1) Rename the constructor parameter so that drawArea always refers to the member variable.
2) Declare the constructor parameter final with the final keyword.
3) Refer to the drawArea inside the inner classes using the 'qualified this' variable.
The third option is the one I would use, the first being my second choice and the second option the last.
Inside the inner class, 'this' refers to the instance of the inner class. You can refer to the instance of the outter class associated with that instance by prepending the name of the enlosing class with a '.' to the 'this' keyword. For example:
public ShapeButtons(PickCanvas drawArea) {
this.drawArea= drawArea;
rect = new Button( "Rect" );
ActionListener lis1 = new ActionListener() {
public void actionPerformed( ActionEvent e ) {
//ShapeButtons.this refers to instance of enclosing class
ShapeButtons.this.drawArea.setShape(1);
}I was being nice and I answered your question, but next USE CODE TAGS!!!
E. West -
Easy question about buttons and panels
Hey all,
I have a problem with button visibility.
When I put buttons on a panel and then make the panel invisible,
you can still see the buttons if you move your mouse over them!
Strangely enough this only happens when I use a panel in a seperate class. Does anyone know why this happens, or better yet; a solution?
ThanksSomehow I don't believe you. What do you mean "...you can still see the buttons if you move your mouse over them...". Is there a chance that you hae mixed AWT and Swing? Please post a small code example(of course formatted using the 'code' button).
Mike -
[SOLVED] Where is application icon in window buttons XFCE panel locat?
I installed chromium but in windows buttons panel, didn't show chromium icon. It's show an square icon instead chromium icon and seems like it's default icon.
You see? Genymotion and Thunar and Panel Properties has a icon so where there icons location ?
Last edited by Vahids (2015-05-27 05:53:52)I found this from source code:
tmp = netk_window_get_icon(win);
if (tmp) {
gint w, h;
w = gdk_pixbuf_get_width(tmp);
h = gdk_pixbuf_get_height(tmp);
if (w != 22 || h != 22) {
icon = gdk_pixbuf_scale_simple(tmp, 24, 24, GDK_INTERP_BILINEAR);
*unref_needed = g_list_prepend(*unref_needed, icon);
} else {
icon = tmp;
but i didn't understand! seems like it's scaling some icon. but I don't know what icon.
Last edited by Vahids (2015-05-27 05:30:11) -
Only one button on panel seems to work
hi all, i have a question regarding this app i am attempting to make. it is supposed to act like a number pad where the user clicks buttons to add an amount to a jtextfield. then click one of four buttons to convert to euros, yen, or rubles. the code seems to be right, but i must be missing something because for some reason only the euros button works, and it says it converted to rubles. ive been stuck here for quite some time, so any help would be much appreciated
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
A GUI application that uses grid layout to
play tic tac toe
@author Jared Letendre
@version 10-05-07
public class DollarConverter
creates a BetterCostFrame
@param args not used here
public static void main(String args[])
ConvertFrame mainFrame = new ConvertFrame();
mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
mainFrame.setVisible(true);
class ConvertFrame extends JFrame
constructs a ConverterFrame instance
public ConvertFrame()
this.setTitle("Dollar Converter");
this.setSize(this.DEFAULT_WIDTH, this.DEFAULT_HEIGHT);
OuterPanel panel = new OuterPanel();
this.add(panel);
private final static int DEFAULT_WIDTH = 550;
private final static int DEFAULT_HEIGHT = 350;
class OuterPanel extends JPanel
constructs a MainPanel panel instance
public OuterPanel()
this.setLayout(new BorderLayout());
// northern panel
JPanel dollarPanel = new JPanel();
JLabel dollarLabel = new JLabel("U.S. Dollars: " + " $");
dollarLabel.setForeground(this.COLOR_1);
dollarLabel.setFont(this.FONT);
dollarOutput = new JTextField("", 10);
dollarOutput.setEditable(false);
dollarOutput.setHorizontalAlignment(JTextField.RIGHT);
dollarPanel.add(dollarLabel);
dollarPanel.add(dollarOutput);
this.add(dollarPanel, BorderLayout.NORTH);
// southern panel
JPanel bottomPanel = new JPanel();
JLabel equalsLabel = new JLabel("Equals...");
resultsLabel = new JLabel(" By: Jared Letendre");
equalsLabel.setForeground(this.COLOR_1);
equalsLabel.setFont(this.FONT);
resultsLabel.setForeground(this.COLOR_1);
resultsLabel.setFont(this.FONT);
convertedOutput = new JTextField("", 10);
convertedOutput.setEditable(false);
convertedOutput.setHorizontalAlignment(JTextField.RIGHT);
bottomPanel.add(equalsLabel);
bottomPanel.add(convertedOutput);
bottomPanel.add(resultsLabel);
this.add(bottomPanel, BorderLayout.SOUTH);
// western panel
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(0, 1, 5, 5));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 65, 40, 65));
JButton toEuros = new JButton("To Euros");
JButton toYen = new JButton("To Yen");
JButton toRubles = new JButton("To Rubles");
JButton clear = new JButton("Clear");
toEuros.setFont(this.FONT);
toEuros.addActionListener(new ConvertAction());
toYen.setFont(this.FONT);
//toYen.addActionListener(new ConvertAction());
toRubles.setFont(this.FONT);
//toRuples.addActionListener(new ConvertAction());
clear.setFont(this.FONT);
buttonPanel.add(toEuros);
buttonPanel.add(toYen);
buttonPanel.add(toRubles);
buttonPanel.add(clear);
this.add(buttonPanel, BorderLayout.WEST);
// center panel
int numRows = 4;
int numCols = 3;
JPanel middlePanel = new JPanel();
middlePanel.setLayout(new GridLayout(numRows, numCols, 5, 5));
middlePanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
JButton[] buttonArray = new JButton[12];
for (int i = 0; i < buttonArray.length; i++)
buttonArray[i] = new JButton("" + (i+1) );
buttonArray.setFont(this.FONT);
buttonArray[i].addActionListener(new ButtonAction());
// loop through buttons to mask two spots on side of 0 button
int next = 0;
for (int r = 1; r <= numRows; r++)
for (int c = 1; c <= numCols; c++)
if (r == 4 && c == 3)
this.add(new JLabel(""));
next++;
else
middlePanel.add(buttonArray[next]);
next++;
buttonArray[9].setVisible(false);
buttonArray[10].setText("0");
this.add(middlePanel, BorderLayout.CENTER);
An action listener that appends a buttons value
to the end of the dollar amount label
private class ButtonAction implements ActionListener
public void actionPerformed(ActionEvent e)
JButton button = (JButton) e.getSource();
if(button.getText().equals("0"))
dollarOutput.setText(dollarOutput.getText() + "0");
else
dollarOutput.setText(dollarOutput.getText() + button.getText());
An action listener that converts the dollar
value to either euros, yen, or rubles(russian version)
private class ConvertAction implements ActionListener
public void actionPerformed(ActionEvent e2)
int convertedVal = 0;
Formatter fmt = new Formatter();
int dollarVal = Integer.parseInt(dollarOutput.getText());
JButton button = (JButton) e2.getSource();
if(button.getText().equals("To Euros"))
fmt.format("%.2f", (dollarVal / 1.4154));
convertedOutput.setText(String.valueOf(fmt));
resultsLabel.setText("Euros");
if(button.getText().equals("To Yen"));
fmt.format("%.2f", (dollarVal * 116.5));
convertedOutput.setText(String.valueOf(fmt));
resultsLabel.setText("Yen");
if(button.getText().equals("To Rubles"));
fmt.format("%.2f", (dollarVal * 24.941));
convertedOutput.setText(String.valueOf(fmt));
resultsLabel.setText("Rubles");
// data fields
public final static Color COLOR_1 = new Color(47, 79, 79);
public final static Color COLOR_2 = new Color(135, 206, 235);
public final static Font FONT = new Font("Serif", Font.BOLD, 14);
private JTextField dollarOutput;
private JTextField convertedOutput;
private JLabel resultsLabel;
would this be the right format for testing which button was clicked? it is how i have been doing in other applications and it has worked
if(button.getText().equals("To Euros"))
fmt.format("%.2f", (dollarVal / 1.4154));
convertedOutput.setText(String.valueOf(fmt));
resultsLabel.setText("Euros");
if(button.getText().equals("To Yen"));
fmt.format("%.2f", (dollarVal * 116.5));
convertedOutput.setText(String.valueOf(fmt));
resultsLabel.setText("Yen");
if(button.getText().equals("To Rubles"));
fmt.format("%.2f", (dollarVal * 24.941));
convertedOutput.setText(String.valueOf(fmt));
resultsLabel.setText("Rubles");..but it is still acting wierd
if(button.getText().equals("To Yen"));//<---remove the semi-colon
if(button.getText().equals("To Rubles"));//<---remove the semi-colon -
Hi all
This is frustrating me so I'm hoping someone has some tips. When I copy a button from one project to another, I often want to change the button image. In the button properties, there is a little folder icon that lets me open my button gallery folder on the C: but it is only just accessible, and sometime, not visible at all (see image). To the right of the 'image button' combo box, I should see a folder, so I can quickly find the button image I need, but in this case it is not visible and there are no horizontal scroll bars at the bottom of the properties panel.
Has anyone had this issue and found a resolution or work around? Any help would be appreciated.
Regards
AmandaOK. Well in that case your best recourse might be to copy the files for your buttons in the Gallery and rename them to have much shorter names. I don't think moving the buttons around is going to fix the issue. And (from memory) renaming the existing buttons doesn't do the trick either. Captivate sets the width of this area by the name of the longest button in the Gallery. But for some reason, even if you remove or rename those buttons so that they are all short-named again, Captivate seems to think they are still there. It retains settings somewhere about this. You may even need to delete your Preferences file to reset everything.
-
Click on button in panel in jlist? how to pass on the event
hello
I have a panel of some buttons that i want to be able to load in as many as i need dynamically into a jlist. i get them in fine, but then i can't click on the buttons. i can grab mouse events and listselection events from the list, but i cant get back to those buttons. i've read the tutorial on advanced jlist programming and it doesnt seem to deal with this.
any idea on how to accomplish this?
thanksPassing parameters to an action method violates the Model-View-Controller paradigm. The button you push should not know anything about the data (your model) in your application.
The button should simply tell the controller "I have been touched!". The controller is the mediator between the view and the model. So the controller is responsible for working with the model objects in an appropriate way when it learns the button was touched. Typically there are instance variables in the controller object that represent model objects. So in your event handler you will have access to them -- there is no need to "pass them in as parameters".
This is in essence what iPhil is talking about.
Cheers,
George -
I want to use a button and+ mouse. How can I do this ?? Help me
Hello,
You need to enable zooming:
http://digital.ni.com/public.nsf/allkb/D7D38C80BF7F875A86256F9D00832681 -
Hi If i want 3 Buttons in a pannel, one on left one in center and one on the right. How can i do this. I am trying this.
BottomP = new JPanel (new BorderLayout ());
JPanel insideBottomL = new JPanel (new FlowLayout(FlowLayout.LEFT));
BottomP.add(insideBottomL, BorderLayout.NORTH);
backB = new JButton ("Back");
insideBottomL.add(backB);This puts backB buttons on the far left but if i add another button to the pannel it is set up right beside backB button but i want it to be in CENTER.
Any suggestions?
-bhaaratanother option
import javax.swing.*;
import java.awt.*;
class Testing extends JFrame
public Testing()
setLocation(400,300);
setSize(300,100);
setDefaultCloseOperation(EXIT_ON_CLOSE);
JPanel BottomP = new JPanel (new BorderLayout ());
JPanel insideBottomL = new JPanel (new GridLayout(1,3)); //<-------------------
insideBottomL.add(new JButton ("Back"));
insideBottomL.add(new JButton ("Hold"));
insideBottomL.add(new JButton ("Next"));
BottomP.add(insideBottomL, BorderLayout.NORTH);
getContentPane().add(BottomP);
public static void main(String args[]){new Testing().setVisible(true);}
} -
How can I use the button in one panel to control the other panel's appearing and disappearing?
How can I use the button in one panel to control the other panel's
appearing and disappearing? What I want is when I push the button on
one button . another panel appears to display something and when I
push it again, that the second panel disappears.> How can I use the button in one panel to control the other panel's
> appearing and disappearing? What I want is when I push the button on
> one button . another panel appears to display something and when I
> push it again, that the second panel disappears.
>
You want to use a combination of three features, a button on the panel,
code to notice value changes using either polling in a state machine of
some sort or an event structure, and a VI Server property node to set
the Visible property of the VI being opened and closed.
The button exists on the controlling panel. The code to notice value
changes is probably on the controlling panel's diagram, and this diagram
sets the Visible property node of a VI class property node to FALSE or
TRUE to show or
hide the panel. To get the VI reference to wire to the
property node, you probably want to use the Open VI Reference node with
the VI name.
Greg McKaskle -
How to close the detach popup on click of a button in the panel collection
Hi,
I'm using Jdeveloper 11.1.2.3.0.
I have an af table surrounded by panel collection. There is a button on panel collection to commit the changes in the table.
Clicked detach button to view the table in full browser.
On click of Commit button, the detach popup is not closed. I have set partialSubmit of that button to false. Then also detach popup is not closed.
Can anybody suggest me how to close the detach popup on click of a button in the toolbar.
Thanks,
VinodHi Frank,
Thanks for your response. Popup is not closed.
I tried this approach, when the view tree is navigated on the Detach, I see that the tree is same as if it is traversed on the page without detach.
Printed client id and UI component class in the while loop, result is as below.
r1:0:pc1:t3 class oracle.adf.view.rich.component.rich.layout.RichToolbar
r1:0:pc1 class oracle.adf.view.rich.component.rich.output.RichPanelCollection
r1:0:ph2 class oracle.adf.view.rich.component.rich.layout.RichPanelHeader
r1:0:pgl1 class oracle.adf.view.rich.component.rich.layout.RichPanelGroupLayout
r1 class oracle.adf.view.rich.component.rich.fragment.RichRegion
pgl1 class oracle.adf.view.rich.component.rich.layout.RichPanelGroupLayout
db2 class oracle.adf.view.rich.component.rich.layout.RichDecorativeBox
db1 class oracle.adf.view.rich.component.rich.layout.RichDecorativeBox
psl1 class oracle.adf.view.rich.component.rich.layout.RichPanelStretchLayout
ps1 class oracle.adf.view.rich.component.rich.layout.RichPanelSplitter
f1 class oracle.adf.view.rich.component.rich.RichForm
Tried with setting partialsubmit property to false on the command button, still the popup is not closed and my Faces Message are shown behind the detach popup.
Thanks,
Vinod -
How to keeps button in center of resizable dialog/panel?
Hi all,
Is there any ways to make a button still in center of dialog/panel when I resize dialog/panel without changes its frame size?
I'm using kBindAll but the button will be changed frame size. Can anybody please help me resolve that?
My attribute of button:
ButtonWidget
kAMPBrowseBtWidgetID,
kSysButtonPMRsrcId, // The Plugin ID
kBindAll, // Frame binding
Frame(64,220,200,246) // Frame(4,4,265,320) // Frame
kTrue, // Is this visible
kTrue, // Is this enabled
"Browse Pages", // The String valueHi,
I couldn't get it to work using the binding.
There may be a better way of doing it, but I got it working by setting to kBindNone and moving the button on panel resize events:
Firstly, make sure you have a custom class for your panel's control view.
Mark it up in the fr file for the panel's widget boss class with:
IID_ICONTROLVIEW, kMyPanelViewImpl,
Add to the ID definitions, factory list etc and set up a MyPanelView class (or whatever you want to call it...), derived from PanelView, for this implementation
Then in your MyPanelView class, setup the Resize function as below:
void MyPanelView::Resize(const PMPoint& dimensions, bool16 invalidate)
PanelView::Resize(dimensions, invalidate);
InterfacePtr<IPanelControlData> panelData(Utils<IPalettePanelUtils>()->QueryPanelByWidgetID(kMyPanelWidgetID));
if(panelData == nil) return;
IControlView *myWidget = panelData->FindWidget(kMyButtonWidgetID);
if (myWidget == nil) return;
PMRect theFrame = myWidget->GetFrame();
PMReal left = (dimensions.X() - theFrame.Width()) / 2;
PMReal right = left + theFrame.Width();
theFrame.Left(left);
theFrame.Right(right);
myWidget->SetFrame(theFrame, kTrue);
You will need these includes:
#include "Utils.h"
#include "IPalettePanelUtils.h"
Hope that helps
Maybe you are looking for
-
FCE 2 and Macbook pro 2.4GHz incompatible ???
Hello, The error message is (translation of the French version): " error configuration - your material or software configuration does not correspond to the requirements of this software. Graphics board AGP"
-
Netweaver 7.3 installation error while starting dispatcher
Hi Experts I am installing PI 7.3 on a distributive host Linux RHEL 5.7 & Oracle 11.2g I have installed ASCS & SCS and DB instance and now i am installing CI while installing CI its stuck while starting dispatcher Please see the below logs dev_disp t
-
HAVE POSTGRESQL JDBC 2.0 ??? HELPPPPPPPPPPP
i am using jdbc7.0-1.2.jar this jdbc driver implements the jdbc 2.0 api ???? when i run this code above a \n error ocurrs SQLEXCEPTION: this method is not yet implemented here is the code: stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE
-
Large RTF Display/Printing Issue
I have a large ColdFusion Report being generated in a RTF format (4.5 MB). The last few pages of the report are not displaying/printing correctly. The report contains 161 pages, the last 10 pages are displaying/printing incorrectly. In the last 10 pa
-
I have a non encrypted video from a DVD in video TS format. I use handbrake to convert to m4v but i movie will not import. i tried to change the extension to .mov still wont import? i dont see apple intermediate codec option in handbrake or imovie?