Hiding and displaying cfcharts
I use cfchart a lot - flash charts from queries - and think
it's great. The problem is that it is so great I want to display
more charts for users.
I don't want my web pages to get too long and I don't want
users to have to click links to other pages to see additional
charts. I've seen websites that let you click on links (or better
yet, tabs) and other charts pop up replacing the chart that was
there.
Is there a way to do this in coldfusion wth cfcharts?
Thanks,
Mike
TestStand I am still learning, but LabVIEW I know. There are several things that you could do. One thing would be a splash screen. I don't think that this is what you are after, though.
Each control has a terminal on the block diagram. If you right click on the terminal, you can create a property node. There are lots of properties that you can set on a control, including whether it is visible or greyed out. I think you want to hide the controls and SAVE the VI that way. Then, when the VI is run, where the control/indicator gets its data, set it to visible with the property node as well. If this is in a subVI, you might need to create a reference to the control/indicator and pass that into the VI as well. You can then wire it to a property node in the subVI.
There are several examples on using property nodes that ship with LabVIEW that should be able to get you started.
Hope that this helps,
Bob Young
Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
DISTek Integration, Inc. - NI Alliance Member
mailto:[email protected]
Similar Messages
-
Hiding and Displaying TS UI Controls from LabView
We have a custom TestStand User Interface, written in LabView, that is a modified 'Simple' User Interface as installed with TestStand.
When our UI is initialising the TestStand UI controls are immediately displayed with nothing displayed inside them, this looks very untidy. Is there a way of hiding and displaying TS UI controls on demand?
Regards
Steve
Message Edited by SercoSteve on 03-09-2006 09:22 AM
There are 10 types of people in the world that understand binary, those that do and those that don't.TestStand I am still learning, but LabVIEW I know. There are several things that you could do. One thing would be a splash screen. I don't think that this is what you are after, though.
Each control has a terminal on the block diagram. If you right click on the terminal, you can create a property node. There are lots of properties that you can set on a control, including whether it is visible or greyed out. I think you want to hide the controls and SAVE the VI that way. Then, when the VI is run, where the control/indicator gets its data, set it to visible with the property node as well. If this is in a subVI, you might need to create a reference to the control/indicator and pass that into the VI as well. You can then wire it to a property node in the subVI.
There are several examples on using property nodes that ship with LabVIEW that should be able to get you started.
Hope that this helps,
Bob Young
Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
DISTek Integration, Inc. - NI Alliance Member
mailto:[email protected] -
Hi Every body :
In my application I have 4 tabs and I want to know how I can hide the tab according to the user previllige, if he has the privillage then the tab will be visible and if he doesn't it shold be hided...
Thanx in advanceJTabbedPane itself uses the visibility of the children to control which one is shown and, of course, draws the tabs itself. There is no way to hide a tab, just don't add the child in the first place.
-
Supress Subtotal rows and display overall result of keyfigure
Hello there,
Is there a procedure to hide result of a keyfigure at subtotal level and display result at overall result level?
Please let me know.
Points assured.
regards
JogaHi Daya,
Thanks for the reply. in the report i have other keyfigures also for which i need to show subtotals.
its only for 3 keyfigures i need to hide the subtotal result and show overall result.
when iam hiding the result rows of the key figure iam not getting the result in the overall result column as well.
i only want a result for overall result while supressing the subtotals for 3 keyfigures out of 10 keyfigures.
regards
Joga -
Calculating and displaying the Length of the side of a triangle
Hi everyone. I am currently working on Dragging and Stretching a triangle on screen. Ive got it working to a certain extent but the only problem is that whenever I go to the point from which i have to drag my triangle i.e. the Left hand Corner of the BAse at exactly 300,300 it redraws a new triangle below the existing one and then when i stretch it from the top and the right it leaves a trail of triangles everytime. But when i resize my window it clears the trail only to start agian when I drag or stretch it...
All my code for wahtever I have done is displayed below. I would appreciate all the help that any one can offer.
Secondly , as I stretch my triangle I would like to calculate My Length of the hypotenuse and the other 2 sides as they change and display it in System.out.println for now...
PLEASE HELP
the code is
This is my Main Form --- Interactive Geometry.java
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import javax.swing.JFrame;
* InteractiveGeometry.java
* Created on 30 November 2004, 20:29
* @author Kripa Bhojwani
public class InteractiveGeometry extends javax.swing.JFrame {
public EastPanel eastpanel;
public Container container;
public GeomPanel gp;
public boolean pressed = false;
public boolean pressT = false;
public boolean pressR = false;
/** Creates new form InteractiveGeometry */
public InteractiveGeometry() {
initComponents();
eastpanel = new EastPanel();
container = new Container();
Model model = new Model(300,150,450,300,300,300);
gp = new GeomPanel(model);
container = getContentPane();
container.add(eastpanel,BorderLayout.EAST);
container.add(gp,BorderLayout.CENTER);
setSize(1400,9950);
gp.addMouseMotionListener(
new MouseMotionListener() { //anonymous inner class
//handle mouse drag event
public void mouseDragged(MouseEvent me) {
setTitle("Dragging: x=" + me.getX() + "; y=" + me.getY());
public void mouseMoved(MouseEvent me) {
setTitle("Moving: x=" + me.getX() + "; y=" + me.getY());
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
private void initComponents() {
jMenuBar2 = new javax.swing.JMenuBar();
jMenu2 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu1 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
formMouseDragged(evt);
public void mouseMoved(java.awt.event.MouseEvent evt) {
formMouseMoved(evt);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
jMenuBar2.setBackground(new java.awt.Color(0, 102, 204));
jMenu2.setBackground(new java.awt.Color(222, 222, 238));
jMenu2.setText("File");
jMenu2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu2ActionPerformed(evt);
jMenuItem1.setBackground(new java.awt.Color(204, 255, 255));
jMenuItem1.setText("Exit");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
jMenu2.add(jMenuItem1);
jMenuBar2.add(jMenu2);
jMenu1.setBackground(new java.awt.Color(199, 215, 255));
jMenu1.setText("Theorem ");
jMenuItem2.setText("Pythagoras Theorem");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
jMenu1.add(jMenuItem2);
jMenuBar2.add(jMenu1);
setJMenuBar(jMenuBar2);
pack();
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
private void formMouseDragged(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
private void formMouseMoved(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
public void mouseDragged(MouseEvent me) {
setTitle("Dragging: x=" + me.getX() + "; y=" + me.getY());
private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
* @param args the command line arguments
public static void main(String args[]) {
InteractiveGeometry ig = new InteractiveGeometry();
ig.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ig.show();
// new InteractiveGeometry().show();
// Variables declaration - do not modify
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar2;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
// End of variables declaration
This is my Panel -- GeomPanel.java which draws everything -- /*
* GeomPanel.java
* Created on 30 November 2004, 20:29
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.Graphics.*;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.awt.event.*;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import javax.swing.event.TableModelListener;
import javax.swing.JScrollPane;
import javax.swing.event.*;
import java.awt.Dimension;
import java.awt.Container.*;
* @author Kripa Bhojwani
public class GeomPanel extends javax.swing.JPanel implements Observer, MouseMotionListener, MouseListener {
private Model model;
private boolean pressed = false;
private boolean pressT = false;
private boolean pressR = false;
/** Creates new form GeomPanel */
public GeomPanel(Model model) {
this.model = model;
model.addObserver(this);
addMouseListener(this);
addMouseMotionListener(this);
initComponents();
setBackground(Color.getHSBColor(6,600,660));
public void paintComponent(Graphics gfx) {
Graphics2D g = (Graphics2D) gfx;
Point tc = model.getTop();
Point lc = model.getLeft();
Point rc = model.getRight();
Point2D.Double p1 = new Point2D.Double(tc.getX(),tc.getY());
Point2D.Double p2 = new Point2D.Double(lc.getX(),lc.getY());
Point2D.Double p3 = new Point2D.Double(rc.getX(),rc.getY());
Line2D.Double line = new Line2D.Double(p1, p2);
Line2D.Double line1 = new Line2D.Double(p2, p3);
Line2D.Double line2 = new Line2D.Double(p1, p3);
g.setColor(Color.BLACK);
g.draw(line);
g.draw(line2);
g.draw(line1);
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
private void initComponents() {
setLayout(new java.awt.BorderLayout());
addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
formMouseDragged(evt);
private void formMouseDragged(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
public void mouseClicked(MouseEvent e) {
public void mouseDragged(MouseEvent e) {
System.out.println("Dragged at "+ e.getX()+ "," + e.getY());
if(pressed == true){
model.setLeft(e.getX() , e.getY());
else if(pressT == true){
model.setTop(e.getX() , e.getY());
else if (pressR == true){
model.setRight(e.getX(), e.getY());
else{
pressed = false;
pressT= false;
pressR=false;
repaint();
public void mouseEntered(MouseEvent e) {
public void mouseExited(MouseEvent e) {
public void mouseMoved(MouseEvent e) {
System.out.println("Mouse at " + e.getX() +"," + e.getY());
public void mousePressed(MouseEvent e) {
if (model.getLeft().getX()== e.getX() && model.getLeft().getY()== e.getY()){
pressed = true;
else if (model.getTop().getX()==e.getX() && model.getTop().getY()==e.getY()){
pressT = true;
else if(model.getRight().getX() == e.getX() && model.getRight().getY()==e.getY()){
pressR = true;
// else if(model.getCircle().getX() == e.getX() && model.getCircle().getY() == e.getY()){
// inoval = true;
else {
pressed =false;
pressT = false;
pressR = false;
} repaint();
public void mouseReleased(MouseEvent e) {
if(pressed == true){
model.setLeft(e.getX(),e.getY());
else if (pressT ==true ){
model.setTop(e.getX(), e.getY());
else if(pressR ==true){
model.setRight(e.getX(),e.getY());
else {
pressed = false;
pressT = false;
pressR = false;
repaint();
public void update(Observable o, Object arg) {
repaint();
// Variables declaration - do not modify
// End of variables declaration
This is my Model class called Model.java which Holds all teh data for my triangle
import java.awt.Point;
import java.util.Observable;
* Model.java
* Created on 05 December 2004, 14:11
* @author Kripa Bhojwani
public class Model extends Observable{
private int x1,x2,x3, y1,y2,y3;
private int _transx;
private int _transy;
private int _c;
private int _d;
/** Creates a new instance of Model */
public Model(int x1, int y1, int x2, int y2, int x3, int y3) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.x3 = x3;
this.y3 = y3;
setChanged();
notifyObservers();
public void setTop(int x1, int y1){
//this.x1 =x1;
this.y1= y1;
setChanged();
notifyObservers();
public void setRight(int x2, int y2){
this.x2 = x2;
// this.y2 =y2;
setChanged();
notifyObservers();
public void setLeft(int x3, int y3){
_transx = x3 - this.x3;
_transy = y3 - this.y3;
this.x3 += _transx;
this.y3 += _transy;
this.y2 += _transy;
this.x2 += _transx;
this.x1 += _transx;
this.y1 += _transy;
setChanged();
notifyObservers();
public Point getTop(){
Point p = new Point(x1,y1);
return p;
public Point getRight(){
Point p1 = new Point(x2,y2);
return p1;
public Point getLeft(){
Point p3 = new Point(x3,y3);
return p3;
public void update() {
setChanged();
notifyObservers();
This is my TableModel which is the JTable to display all the Cordinates and Lengths and other Measurements like angles etc./*
* TableModel.java
* Created on 03 December 2004, 15:08
import javax.swing.JTable;
import javax.swing.JScrollPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.*;
import java.awt.event.*;
import java.util.Observer;
import javax.swing.event.TableModelEvent;
import javax.swing.table.AbstractTableModel;
* @author Kripa Bhojwani
public class TableModel extends AbstractTableModel implements Observer{
private String[] columnNames = {"Point", "X Coordinate", "Y Coordinate"};
private Object[][] data = {};
private int rowCount;
private int columnCount;
/** Creates a new instance of TableModel */
public TableModel() {
rowCount = 0;
columnCount = 3;
public int getColumnCount() {
return columnCount;
public int getRowCount() {
return rowCount;
public String getColumnName(int col) {
return columnNames[col];
public void setColumnName (String[] name){
columnNames = name;
public void setValueAt(Object obj, int row, int col) {
data[row][col] = obj;
fireTableCellUpdated(row, col);
TableModelEvent tme = new TableModelEvent(this);
fireTableChanged(tme);
public Object getValueAt(int row, int col) {
return data[row][col];
public void update(java.util.Observable o, Object arg) {
This is the Panel on the east side of My Main application form which will display all the measurements and Cordinates ---EastPanel.java
import java.awt.BorderLayout;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.event.TableModelListener;
import java.awt.Dimension;
* EastPanel.java
* Created on 04 December 2004, 23:07
* @author Kripa Bhojwani
public class EastPanel extends javax.swing.JPanel implements TableModelListener{
private TableModel tm;
/** Creates new form EastPanel */
public EastPanel() {
initComponents();
tm = new TableModel();
JTable table1 = new JTable(tm);
table1.setPreferredScrollableViewportSize(new Dimension(250,264));
table1.getModel().addTableModelListener(this);
JScrollPane sp = new JScrollPane(table1);
add(sp,BorderLayout.EAST);
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
private void initComponents() {
setLayout(new java.awt.BorderLayout());
public void tableChanged(javax.swing.event.TableModelEvent e) {
// Variables declaration - do not modify
// End of variables declaration
}import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.text.NumberFormat;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.DefaultTableCellRenderer;
public class G
public G()
TriangleModel tri = new
ri = new TriangleModel(175,100,175,250,325,250);
TriangleView view = new TriangleView(tri);
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(view.getUIPanel(),
Panel(), "North");
f.getContentPane().add(view);
f.getContentPane().add(view.getTablePanel(),
Panel(), "South");
f.setSize(500,500);
f.setLocation(200,200);
f.setVisible(true);
public static void main(String[] args)
new G();
class TriangleModel // (x1,
y1)
{ // |\
static final int SIDES = 3; // | \
private int cx, cy; // |
| \
Polygon triangle; // |_
|_ _\ (x3, y3)
int selectedIndex; // (x2,
(x2, y2)
NumberFormat nf;
Line2D[] medians;
Point2D centroid;
public TriangleModel(int x1, int y1, int x2, int
int y2, int x3, int y3)
int[] x = new int[] { x1, x2, x3 };
int[] y = new int[] { y1, y2, y3 };
triangle = new Polygon(x, y, SIDES);
nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(1);
public boolean contains(Point p)
// Polygon.contains doesn't work well enough
return (new Area(triangle)).contains(p);
public boolean isLineSelected(Rectangle r)
Line2D line = new Line2D.Double();
for(int j = 0; j < SIDES; j++)
int[] x = triangle.xpoints;
int[] y = triangle.ypoints;
int x1 = x[j];
int y1 = y[j];
int x2 = x[(j + 1) % SIDES];
int y2 = y[(j + 1) % SIDES];
line.setLine(x1, y1, x2, y2);
if(line.intersects(r))
selectedIndex = j;
return true;
selectedIndex = -1;
return false;
* Only works for right triangle with right angle
angle at (x2, y2)
public void moveSide(int dx, int dy, Point p)
int[] x = triangle.xpoints;
int[] y = triangle.ypoints;
switch(selectedIndex)
case 0:
x[0] += dx;
x[1] += dx;
break;
case 1:
y[1] += dy;
y[2] += dy;
break;
case 2:
double rise = y[2] - y[0];
double run = x[2] - x[0];
double slope = rise/run;
// rise / run == (y[2] - p.y) / (x[2]
] - p.y) / (x[2] - p.x)
x[2] = p.x + (int)((y[2] - p.y) /
)((y[2] - p.y) / slope);
// rise / run == (p.y - y[0]) / (p.x
y - y[0]) / (p.x - x[0])
y[0] = p.y - (int)((p.x - x[0]) *
)((p.x - x[0]) * slope);
public void translate(int dx, int dy)
triangle.translate(dx, dy);
public Polygon getTriangle()
return triangle;
public String findCentroid()
int[] x = triangle.xpoints;
int[] y = triangle.ypoints;
// construct the medians defined as the line
the line from
// any vertex to the midpoint of the opposite
opposite line
medians = new Line2D[x.length];
for(int j = 0; j < x.length; j++)
int next = (j + 1) % x.length;
int last = (j + 2) % x.length;
Point2D vertex = new Point2D.Double(x[j],
Double(x[j], y[j]);
// get midpoint of line opposite vertex
double dx = ((double)x[last] -
le)x[last] - x[next])/2;
double dy = ((double)y[last] -
le)y[last] - y[next])/2;
Point2D oppLineCenter = new
Center = new Point2D.Double(x[next] + dx,
y[next]
y[next] + dy);
medians[j] = new Line2D.Double(vertex,
uble(vertex, oppLineCenter);
// centroid is located on any median 2/3 the
2/3 the way from the
// vertex (P1) to the midpoint (P2) on the
) on the opposite side
double[] lengths = getSideLengths();
double dx = (medians[0].getX2() -
etX2() - medians[0].getX1())*2/3;
double dy = (medians[0].getY2() -
etY2() - medians[0].getY1())*2/3;
double px = medians[0].getX1() + dx;
double py = medians[0].getY1() + dy;
//System.out.println("px = " + nf.format(px)
rmat(px) +
// "\tpy = " +
py = " + nf.format(py));
centroid = new Point2D.Double(px, py);
return "(" + nf.format(px) + ", " +
", " + nf.format(py) + ")";
public String[] getAngles()
double[] lengths = getSideLengths();
String[] vertices = new
es = new String[lengths.length];
for(int j = 0; j < lengths.length; j++)
int opp = (j + 1) % lengths.length;
int last = (j + 2) % lengths.length;
double top = lengths[j] * lengths[j] +
lengths[last] *
lengths[last] * lengths[last] -
lengths[opp] *
lengths[opp] * lengths[opp];
double divisor = 2 * lengths[j] *
lengths[j] * lengths[last];
double vertex = Math.acos(top /
h.acos(top / divisor);
vertices[j] =
ertices[j] = nf.format(Math.toDegrees(vertex));
return vertices;
public String[] getLengths()
double[] lengths = getSideLengths();
String[] lengthStrs = new
rs = new String[lengths.length];
for(int j = 0; j < lengthStrs.length; j++)
lengthStrs[j] = nf.format(lengths[j]);
return lengthStrs;
public String[] getSquares()
double[] lengths = getSideLengths();
String[] squareStrs = new
rs = new String[lengths.length];
for(int j = 0; j < squareStrs.length; j++)
squareStrs[j] = nf.format(lengths[j] *
lengths[j] * lengths[j]);
return squareStrs;
private double[] getSideLengths()
int[] x = triangle.xpoints;
int[] y = triangle.ypoints;
double[] lengths = new double[SIDES];
for(int j = 0; j < SIDES; j++)
int next = (j + 1) % SIDES;
lengths[j] = Point.distance(x[j], y[j],
(x[j], y[j], x[next], y[next]);
return lengths;
class TriangleView extends JPanel
private TriangleModel model;
private Polygon triangle;
private JTable table;
private JLabel centroidLabel;
private boolean showConstruction;
TriangleControl control;
public TriangleView(TriangleModel model)
this.model = model;
triangle = model.getTriangle();
showConstruction = false;
control = new TriangleControl(this);
addMouseListener(control);
addMouseMotionListener(control);
public void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.draw(triangle);
if(model.medians == null)
centroidLabel.setText("centroid location:
id location: " + model.findCentroid());
// draw medians and centroid point
if(showConstruction && !control.dragging)
g2.setPaint(Color.red);
for(int j = 0; j < 3; j++)
g2.draw(model.medians[j]);
g2.setPaint(Color.blue);
g2.fill(new
g2.fill(new Ellipse2D.Double(model.centroid.getX() -
2,
model.centroid.getY()
model.centroid.getY() - 2, 4, 4));
public TriangleModel getModel()
return model;
public JTable getTable()
return table;
public JLabel getCentroidLabel()
return centroidLabel;
public JPanel getUIPanel()
JCheckBox showCon = new JCheckBox("show
ox("show construction");
showCon.addActionListener(new
ener(new ActionListener()
public void actionPerformed(ActionEvent
(ActionEvent e)
boolean state =
boolean state =
((JCheckBox)e.getSource()).isSelected();
showConstruction = state;
repaint();
JPanel panel = new JPanel();
panel.add(showCon);
return panel;
public JPanel getTablePanel()
String[] headers = new String[] { "", "", "",
// row and column data labels
String[] rowHeaders = {
"sides", "lengths", "squares", "angles",
", "angles", "degrees"
String[] sidesRow = { "vertical",
rtical", "horizontal", "hypotenuse" };
String[] anglesRow = { "hyp to ver", "ver to
"ver to hor", "hor to hyp" };
// collect data from model
String[] angles = model.getAngles();
String[] lengths = model.getLengths();
String[] squares = model.getSquares();
String[][] allData = { sidesRow, lengths,
lengths, squares, anglesRow, angles };
int rows = 5;
int cols = 4;
Object[][] data = new Object[rows][cols];
for(int row = 0; row < rows; row++)
data[row][0] = rowHeaders[row];
for(int col = 1; col < cols; col++)
data[row][col] = allData[row][col -
lData[row][col - 1];
table = new JTable(data, headers)
public boolean isCellEditable(int row,
ble(int row, int col)
return false;
DefaultTableCellRenderer renderer =
(DefaultTableCellRenderer)table.getDefaultRenderer(St
ring.class);
renderer.setHorizontalAlignment(JLabel.CENTER);
centroidLabel = new JLabel("centroid
centroid location: ", JLabel.CENTER);
Dimension d =
sion d = centroidLabel.getPreferredSize();
d.height = table.getRowHeight();
centroidLabel.setPreferredSize(d);
JPanel panel = new JPanel(new
anel(new BorderLayout());
panel.setBorder(BorderFactory.createTitledBorder("tri
angle data"));
panel.add(table);
panel.add(centroidLabel, "South");
return panel;
class TriangleControl extends MouseInputAdapter
TriangleView view;
TriangleModel model;
Point start;
boolean dragging, altering;
Rectangle lineLens; // used for line
line selection
public TriangleControl(TriangleView tv)
view = tv;
model = view.getModel();
dragging = altering = false;
lineLens = new Rectangle(0, 0, 6, 6);
public void mousePressed(MouseEvent e)
Point p = e.getPoint();
lineLens.setLocation(p.x - 3, p.y - 3);
// are we over a line
if(model.isLineSelected(lineLens))
start = p;
altering = true;
// or are we within the triangle
else if(model.contains(p))
start = p;
dragging = true;
public void mouseReleased(MouseEvent e)
altering = false;
dragging = false;
view.getCentroidLabel().setText("centroid
centroid location: " +
model.findCentroid());
view.repaint(); // for the construction
truction lines
public void mouseDragged(MouseEvent e)
Point p = e.getPoint();
if(altering)
int x = p.x - start.x;
int y = p.y - start.y;
model.moveSide(x, y, p);
updateTable();
view.repaint();
start = p;
else if(dragging)
int x = p.x - start.x;
int y = p.y - start.y;
model.translate(x, y);
view.repaint();
start = p;
private void updateTable()
String[] lengths = model.getLengths();
String[] squares = model.getSquares();
String[] angles = model.getAngles();
JTable table = view.getTable();
for(int j = 0; j < angles.length; j++)
table.setValueAt(lengths[j], 1, j + 1);
table.setValueAt(squares[j], 2, j + 1);
table.setValueAt(angles[j], 4, j + 1);
view.getCentroidLabel().setText("centroid
centroid location: " +
model.findCentroid());
Hey sorry mate.. ive got a nother problem.
I need to add loads of theorems to this tool. so i need a JMenu Bar called File with all the normal things. then another Menu called Theorems where i can have a list of JMenuItems with the theorem names --- Like when they click on Pythagoras Theorem it opens up all the triangle and the traingle data that u helped me with.
The thing is im using netbeans and in netbeans i can do it coz its there and all you got to do is put the components together.
Please Help
Thanks...
Sharan -
Help, how to open and display blobs from tables
Dear all,
I am trying to store ms-word files on a table using a blob column.
Does anyone how to open the files and display them from a form using 9iAS?
Thank you.
Carlos.And there may be, but you won't likely find that here. Do some time searching Google and maybe you'll find code that someone was nice enough to make freely available, although I wouldn't count on it. Were i a programmer and took the time to read those docs and write the code, I'd want to be paid for my time. But there are a lot of programmers who swear by freeware! You may get lucky.
-
Open and display image in MVC layout
Hello!
I cant figure out how I shall do this in an MVC layout:
The program request user to open an image file that are then displayed in a JLabel
My setup at the moment resolve in a nullpointerexeption because it dont get any actual image file, but I dont understand what I have missed.
I can not post the whole code fo you to run because it is to big, so I post the part that are the most important. please have a look.
PicturePanel
//Import Java library
import javax.swing.*;
import java.awt.*;
public class PicturePanel extends JPanel {
//Variables
private ImageIcon picture;
//Method to get information of the selected file
PicturePanel (String fileName) {
picture = new ImageIcon (fileName); //Get the filename
int w = picture.getIconWidth(); //Get the image with
int h = picture.getIconHeight(); //Get the image height
//Set preferable size for the image (Use the properties for the selected image)
setPreferredSize(new Dimension(w, h));
setMinimumSize(new Dimension(w, h));
setMaximumSize(new Dimension(w, h));
//Method to draw the selected image
protected void paintComponent(Graphics g) {
super.paintComponent(g); //We invoke super in order to: Paint the background, do custom painting.
g.drawImage(picture.getImage(), 0, 0, this); //Draw the image at its natural state
}From my model:
//Local attributes
boolean check = false; //Used to see if a statement is true or not
PicturePanel pp;
JFileChooser fc;
int returnVal;
//newFile in File menu
public void newFile() {
//Open a file dialog in users home catalog
fc = new JFileChooser();
//In response to a button click:
returnVal = fc.showOpenDialog(pp);
System.out.println("You pressed new in file menu");
}From my controler:
//User press "New" in File menu
else if (user_action.equals("New")) {
//Call method in model class
model.newFile();
//Update changes
if (model.returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("Hello1");
File f = model.fc.getSelectedFile();
if (model.pp != null)
model.pp = new PicturePanel(f.getAbsolutePath());
System.out.println("Hello2");
//Display image (Here is line 83)
view.setImage_DisplayArea(model.pp);
System.out.println("Hello3");
}From my view:
//Sets the image to be displayed on the image_display area (Here is line 302)
public void setImage_DisplayArea(PicturePanel pp) {
image_display.add(pp);
}The complet error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.awt.Container.addImpl(Container.java:1015)You pressed new in file menu
Hello1
Hello2
at java.awt.Container.add(Container.java:351)
at View_Inlupp2.setImage_DisplayArea(View_Inlupp2.java:302)
at Control_Inlupp2.actionPerformed(Control_Inlupp2.java:83)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:334)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1050)
at apple.laf.CUIAquaMenuItem.doClick(CUIAquaMenuItem.java:119)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1091)
at java.awt.Component.processMouseEvent(Component.java:5602)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3129)
at java.awt.Component.processEvent(Component.java:5367)
at java.awt.Container.processEvent(Container.java:2010)
at java.awt.Component.dispatchEventImpl(Component.java:4068)
at java.awt.Container.dispatchEventImpl(Container.java:2068)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
at java.awt.Container.dispatchEventImpl(Container.java:2054)
at java.awt.Window.dispatchEventImpl(Window.java:1801)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)Edited by: onslow77 on Dec 16, 2009 5:00 PM
Edited by: onslow77 on Dec 16, 2009 5:04 PMHello again!
Anyone that can help me figure out how to implement this in an MVC layout, I feel stuck.
I post a little program that open and display an image file so that you better can understand what I whant to do.
ShowImage
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import javax.swing.filechooser.*;
public class ShowImage extends JFrame{
//Variables
JFileChooser fc = new JFileChooser();
PicturePanel pp = null;
ShowImage () {
super("Show"); //Title
//Create the GUI
JPanel top = new JPanel();
add(top, BorderLayout.NORTH);
JButton openBtn = new JButton("Open");
top.add(openBtn);
openBtn.addActionListener(new Listner());
//Settings for the GUI
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setVisible(true);
class Listner implements ActionListener {
public void actionPerformed(ActionEvent ave) {
int answer = fc.showOpenDialog(ShowImage.this);
if (answer == JFileChooser.APPROVE_OPTION){
File f = fc.getSelectedFile();
//Check
System.out.println(f);
System.out.println(pp);
if (pp != null)
remove(pp); //Clean so that we can open another image
//Check
System.out.println(pp);
//Set the PicturePanel
pp = new PicturePanel(f.getAbsolutePath());
//Check
System.out.println(pp);
//Add PicturePanel to frame
add(pp, BorderLayout.CENTER);
validate();
pack();
repaint();
//Main
public static void main(String[] args) {
new ShowImage();
}PicturePanel
//Import Java library
import javax.swing.*;
import java.awt.*;
public class PicturePanel extends JPanel {
//Variables
private ImageIcon picture;
//Method to get information of the selected file
PicturePanel (String fileName) {
picture = new ImageIcon (fileName); //Get the filename
int w = picture.getIconWidth(); //Get the image with
int h = picture.getIconHeight(); //Get the image height
//Set preferable size for the image (Use the properties for the selected image)
setPreferredSize(new Dimension(w, h));
setMinimumSize(new Dimension(w, h));
setMaximumSize(new Dimension(w, h));
//Method to draw the selected image
protected void paintComponent(Graphics g) {
super.paintComponent(g); //We invoke super in order to: Paint the background, do custom painting.
g.drawImage(picture.getImage(), 0, 0, this); //Draw the image at its natural state
}//The endEdited by: onslow77 on Dec 16, 2009 7:30 PM -
Is there a way to open Excell file from the server and display in the UI and save it back on to the
Hello there,
Is there a way to open Excell file from the server and display in the UI and save it back on to the server? (like showing xell file as a datagrid - add rows, columns etc.)Hi Mike,
Welcome you to the forum.
You may try:
SELECT * FROM MyDBNameHere.dbo.OUSR T0
Thanks,
Gordon -
Dear Friends,
Please provide the solution for the following scenario:
In the first view(xml) I have a table with the fields QuotationNo,plant name, material no...etc, where I am displaying the data fetched using Odata model. The table is enable with Single line selection mode. My requirement is to Carry the selected row data to another view(xml) and display there.
Please give your valuable inputs.Hi Rinku,
depending on how you do the navigation, you might find the information here: OpenUI5 SDK - Demo Kit helpful.
Regards Frank -
I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?
Attachments:
try2.txt 2 KB
read_array.vi 21 KBThe problem is in the delimiters in your text file. By default, Read From Spreadsheet File.vi expects a tab delimited file. You can specify a delimiter (like a space), but Read From Spreadsheet File.vi has a problem with repeated delimiters: if you specify a single space as a delimiter and Read From Spreadsheet File.vi finds two spaces back-to-back, it stops reading that line. Your file (as I got it from your earlier post) is delimited by 4 spaces.
Here are some of your choices to fix your problem.
1. Change the source file to a tab delimited file. Your VI will then run as is.
2. Change the source file to be delimited by a single space (rather than 4), then wire a string constant containing one space to the delimiter input of Read From Spreadsheet File.vi.
3. Wire a string constant containing 4 spaces to the delimiter input of Read From Spreadsheet File.vi. Then your text file will run as is.
Depending on where your text file comes from (see more comments below), I'd vote for choice 1: a tab delimited text file. It's the most common text output of spreadsheet programs.
Comments for choices 1 and 2: Where does the text file come from? Is it automatically generated or manually generated? Will it be generated multiple times or just once? If it's manually generated or generated just once, you can use any text editor to change 4 spaces to a tab or to a single space. Note: if you want to change it to a tab delimited file, you can't enter a tab directly into a box in the search & replace dialog of many programs like notepad, but you can do a cut and paste. Before you start your search and replace (just in the text window of the editor), press tab. A tab character will be entered. Press Shift-LeftArrow (not Backspace) to highlight the tab character. Press Ctrl-X to cut the tab character. Start your search and replace (Ctrl-H in notepad in Windows 2000). Click into the Find What box. Enter four spaces. Click into the Replace With box. Press Ctrl-V to paste the tab character. And another thing: older versions of notepad don't have search and replace. Use any editor or word processor that does. -
Refresh table and display the records after insertion of data from back end
Hi Experts,
JDEV 11.1.2.1
I have a useacase which needs data to be inserted from oracle back end procedure and displayed in a ADF Table Component, when a button is pressed.
is this possible?..if yes , how?
Is view object will automatically refreshed and fetches newly created(from back end) rows?
thankz in advance
PMSHi user707,
thankz for ur reply....
i think after executing a procedure you want to call commit operation. better you can perform this.getDbtransaction().commit In Application Module;yes i want to commit transaction after executing back end procedure using preparedStatement.Procedure is for inserting data into same table , which used for creating VO and Read only ADF Table.Procedure is executed fine, but newly created records are not getting into ADF table.Once i did commit opeartion inside back end procedure, whole records are getting into ADF Table.
Is there any way to get whole records without doing Commit operation inside Back end procedure?
PMS -
How to capture an image from my usb camera and display on my front panel
How to capture an image from my usb camera and display on my front panel
Install NI Vision Acquisition Software and NI IMAQ for USB and open an example.
Christian -
Reading XML file into Dynamic Node and Display its output as Table.
Hi All,
Following is the output of XML file:
<Company>
<Employee>
<Name>John</Name>
<Age>23</Age>
<***>Male</***>
<Location>Frankfurt</Location>
</Employee>
<Employee>
<Name>Tina</Name>
<Age>21</Age>
<***>Female</***>
<Location>Boston</Location>
</Employee>
<Department>
<Name>Sales</Name>
<HQ>Chicago</HQ>
<Emplyoees>2300</Employees>
</Department>
I'm able to read the output through DOM parser. But How do I convert this into dynamic node and display this in Web dynpro as Table?
Any pointers in this regard will be great help?
Thanks
SrikantHi Maksim,
I've used your example and its now helping as there is kind of agreement on that I'll be knowing the structure of Xml and I can fill the nodes.
But suppose if you have Xml has following structure :
<?xml version="1.0" encoding="utf-8"?><DATA>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">CONTRACT</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">CREDIT</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">EMPRESS</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">PAYMENT</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
<item><MAILERID TYPE="C" SIZE="000030">21</MAILERID><ORG_CODE TYPE="C" SIZE="000004">1232</ORG_CODE><EVENTID TYPE="C" SIZE="000015">PRICE</EVENTID><SUBSCR_VALUE TYPE="C" SIZE="000001">0</SUBSCR_VALUE></item>
</DATA>
How we will do in this case?
Can we have something similar using DOM? Also what is the best method for displaying data being sent in form of XML. And generalize it for cases like this.
Thanks
Srikant -
How to wrap text in two columns and display as one in WAD
Hi ,
I have the following columns in my ODS , they are not KF's
c1 c2 c3
100 AA BB
200 CC DD
I need this display format
100 AA
BB
200 CC
DD
I need to wrap the text in columns c2 and c3 and display them under one column.
Is it possible in webtemplate by using java scripting.IN the Query , you could diplay Characteristics as a Hierarchy. Just above the Columns Box in Bex, do a write click.
Hope this helps -
Memory problem with loading a csv file and displaying 2 xy graphs
Hi there, i'm having some memory issues with this little program.
What i'm trying to do is reading a .csv file of 215 mb (6 million lines more or less), extracting the x-y values as 1d array and displaying them in 2 xy graphs (vi attacked).
I've noticed that this process eats from 1.6 to 2 gb of ram and the 2 x-y graphs, as soon as they are loaded (2 minutes more or less) are really realy slow to move with the scrollbar.
My question is: Is there a way for use less memory resources and make the graphs move smoother ?
Thanks in advance,
Ierman Gert
Attachments:
read from file test.vi 106 KBHi lerman,
how many datapoints do you need to handle? How many do you display on the graphs?
Some notes:
- Each graph has its own data buffer. So all data wired to the graph will be buffered again in memory. When wiring a (big) 1d array to the graph a copy will be made in memory. And you mentioned 2 graphs...
- load the array in parts: read a number of lines, parse them to arrays as before (maybe using "spreadsheet string to array"?), finally append the parts to build the big array (may lead to memory problems too).
- avoid datacopies when handling big arrays. You can show buffer creation using menu->tools->advanced->show buffer allocation
- use SGL instead of DBL when possible...
Message Edited by GerdW on 05-12-2009 10:02 PM
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome
Maybe you are looking for
-
In need of serious help - BomFatalErrors?
I usually leave my mac on, with the screen the only thing that sleeps, and restart when I need to for updates etc. Never had an issue with that, however when I came back from last weekend to work, my iMac was sitting there with it's sleep light on (t
-
How to use DAQmx Create Scale Linear
Hello. I have an output from an amplifier that is 10mV/V, that is being read by an USB-6002. The voltage range for this amplifier is 0-200 volts. I have been testing the DAQmx Create Scale Vi but do not understand how it works. I have looked at other
-
Error - Oracle BI Server has encountered a problem
Dear Experts, Oracle BI Server has encountered a problem and needs to close. We are sorry for the inconvenience. Error Signature : szAppName : NQSServer.exe szAppVer : 10.1.3.4 szModName : msvcrt.dll szModVer : 7.0.2600.5512 offset : 00037fd4 I am fa
-
Calling Substitution Strings in Supporting Object Installs
So, for lack of a better way of putting it, I have a need to have user input durring the script install part of the supporting objects. I would like to use the Substitution String prompts but can not figure out where it stores the values durring inst
-
I treid letting it run flat, then charging it but it went back to the black screen. Sometimes the mouse icon can be seen and I can move it but it will vanish sometimes.