|
Chinese
|
|
|
|
|
What does this mean, and what have you tried?
|
|
|
|
|
Actually I have two Jpanel. One JPanel which takes input and the result is to be display in another JPanel.I just want that output Jpanel to be display just below the input JPanel.
|
|
|
|
|
|
<blockquote class="quote"><div class="op">Quote:</div>
package Speech.WavePanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import javax.swing.JFrame;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
public class output extends javax.swing.JFrame {
String filepath;
String fileContents;
File file;
BufferedReader br;
public output() {
initComponents();
}
private void ScreenProperties()
{
jLabel1.setSize(new Dimension(800, 150));
jLabel1.setPreferredSize(new Dimension(800, 150));
JFrame frame= new JFrame();
frame.setLocation(1650, 430);
JScrollPane scrollPane = new JScrollPane(jLabel1);
add(scrollPane, BorderLayout.CENTER);
scrollPane = new JScrollPane();
scrollPane.getViewport().add( jLabel1 );
}
@SuppressWarnings("unchecked")
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jLabel1 = new javax.swing.JLabel();
jButton4 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jSeparator1 = new javax.swing.JSeparator();
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jScrollPane3.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jScrollPane3.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
jLabel1.setForeground(java.awt.Color.black);
jLabel1.setText("jLabel1");
jScrollPane3.setViewportView(jLabel1);
jButton4.setText("output_frame4");
jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton4MouseClicked(evt);
}
});
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton3.setText("output_frame3");
jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton3MouseClicked(evt);
}
});
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton2.setText("output_frame2");
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton2MouseClicked(evt);
}
});
jButton1.setText("output_frame1");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3)
.addGap(18, 18, 18)
.addComponent(jButton4)))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jButton3)
.addComponent(jButton4))
.addGap(9, 9, 9)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 12, Short.MAX_VALUE))
);
pack();
}
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
setTitle(" OUTPUT PANEL ");
setBackground(Color.white);
setVisible(true);
filepath ="/home/GUI/Language_Independent/Output/Frame_1.txt";
file = new File(filepath);
fileContents="";
try{
br = new BufferedReader ( new FileReader ( filepath ) ) ;
}
catch(Exception E){
jLabel1.setText(E.toString());
}
try{
while ((fileContents = br.readLine()) != null) {
System.out.println (fileContents) ;
jLabel1.setText(fileContents);
}
br.close();
}
catch(Exception E2){
jLabel1.setText(E2.toString());
}
}
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {
setBackground(Color.WHITE);
setVisible(true);
filepath="/home/GUI/Language_Independent/Output/Frame_2.txt";
file=new File(filepath);
fileContents="";
try
{
br = new BufferedReader(new FileReader(filepath));
}
catch(Exception E)
{
jLabel1.setText(E.toString());
}
try
{
while((fileContents= br.readLine())!=null)
{
System.out.println("fileContents");
jLabel1.setText(fileContents);
}
br.close();
}
catch(Exception E1)
{
jLabel1.setText(E1.toString());
}
}
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
filepath ="/home/GUI/Language_Independent/Output/Frame_4.txt";
file =new File(filepath);
fileContents="";
try
{
br = new BufferedReader(new FileReader(filepath));
}
catch(Exception E)
{
jLabel1.setText(E.toString());
}
try
{
while((fileContents= br.readLine())!=null)
{
System.out.println("fileContents");
jLabel1.setText(fileContents);
}
br.close();
}
catch(Exception E1)
{
jLabel1.setText(E1.toString());
}
}
private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {
filepath="";
file= new File(filepath);
fileContents="";
try
{
br= new BufferedReader(new FileReader(filepath));
}
catch(Exception E)
{
jLabel1.setText(E.toString());
}
try
{
while((fileContents= br.readLine())!=null)
{
System.out.println("fileContents");
jLabel1.setText(fileContents);
}
br.close();
}
catch(Exception E1)
{
jLabel1.setText(E1.toString());
}
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
filepath="";
file = new File(filepath);
fileContents ="";
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(output.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(output.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(output.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(output.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
SwingUtilities.invokeLater(new Runnable(){
public void run() {
new output().setVisible(true);
JScrollPane pn= new JScrollPane();
pn.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
pn.getVerticalScrollBar().setUnitIncrement(10);
pn.setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSeparator jSeparator1;
}
</blockquote>
This is the output file which I want it to display just below my input panel when actionlistener is performed at input panel .actually to make it do i need to create the output panel inside the frame which contained input panel itself? thanks in advance..
|
|
|
|
|
0 down vote favorite
on my ubuntu terminal i was trying to compile and run the program like this
javac -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore.java
successfully compiled.now to run
java -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore
I got error saying
Error: Could not find or load main class GraphExplore
I am newbee in java.please someone help me to resovle this issue.thanks in advance.what i tried to resolve this error.i kept .class file in one folder and run i mean i kept in one path and tried to execute in that path only but it didnt work.please help me
|
|
|
|
|
You need to show us where, in your program, the main method is.
|
|
|
|
|
import org.graphstream.graph.*;
import org.graphstream.graph.implementations.*;
import java.util.Iterator;
public class GraphExplore {
public static void main(String args[]) {
new GraphExplore();
}
public GraphExplore() {
Graph graph = new SingleGraph("tutorial 1");
graph.addAttribute("ui.stylesheet", styleSheet);
graph.setAutoCreate(true);
graph.setStrict(false);
graph.display();
graph.addEdge("AB", "A", "B");
graph.addEdge("BC", "B", "C");
graph.addEdge("CA", "C", "A");
graph.addEdge("AD", "A", "D");
graph.addEdge("DE", "D", "E");
graph.addEdge("DF", "D", "F");
graph.addEdge("EF", "E", "F");
for (Node node : graph) {
node.addAttribute("ui.label", node.getId());
}
explore(graph.getNode("A"));
}
public void explore(Node source) {
Iterator<? extends Node> k = source.getBreadthFirstIterator();
while (k.hasNext()) {
Node next = k.next();
next.setAttribute("ui.class", "marked");
sleep();
}
}
protected void sleep() {
try { Thread.sleep(1000); } catch (Exception e) {}
}
protected String styleSheet =
"node {" +
" fill-color: black;" +
"}" +
"node.marked {" +
" fill-color: red;" +
"}";
}
|
|
|
|
|
Strange, I cannot see anything wrong with your code. Are you sure that the compilation worked successfully and the class file exists in the directory where you are calling the java command from?
|
|
|
|
|
Since your main declaration looks correct, it most likely the compile was not successful.
Look in the directory where you are compiling. See if the file GraphExplore.class was created.
You will get that message if it is not being created as a result of an error. As a further experiment, try misspelling the name when you run it, you will see that it is the exact same error.
|
|
|
|
|
|
in your buildpath,it need load jar ,so u upload this jar in your project, and then server will building it,
|
|
|
|
|
Hello all,
I'm a .net developer.
I have a project that I might get into.
The thing is, the servers are WebLogic.
I don't know a lot on this subject so I wanted to know if I can deploy my asp.NET application on that server (or what I have to do for that)
Thanks for any help
|
|
|
|
|
|
I know it's an ASP.NET application question but since it's also related to Java, I thought that here is also a relevant place to ask. But I'll try there.
|
|
|
|
|
There is nothing Java related in your question.
|
|
|
|
|
WebLogic is an Oracle server for running Java apps.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
OP's question still has nothing to do with Java programming.
|
|
|
|
|
True. But I don't see a better place to put it on CP.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
It belongs in Q&A or Hosting & Servers, it has nothing to do with Java.
|
|
|
|
|
ThetaClear wrote: so I wanted to know if I can deploy my asp.NET application on that server (or what I have to do for that)
In general - no.
There are specialized instances such as writing a proxy or running a command line app but I doubt that is what you had in mind.
|
|
|
|
|
Hi everyone,
I am trying to connect Oracle database from my web application using Eclipse.
But I got the error:org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection;
I used below code:
public static void initDB(){
try {
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
ds.setUrl("jdbc:oracle:thin:@localhost:1521:xe");
ds.setUsername("mybank");
ds.setPassword("123456");
jdbcTemplate = new JdbcTemplate(ds);
isConnected = true;
initSystemPros();
} catch (Exception e) {
System.err.println("Cannot connect to DataBase");
isConnected = false;
}
}
I tried to use SQL Developer to create a connection using above settings and successful.
Do you know what is wrong ?
Thanks and regards,
Tai
|
|
|
|
|
Be sure that `xe` is your `Service Name`.
If the connection is successfull but you have this exception `SQLNestedException: Cannot create PoolableConnectionFactory (Io exception: The Network Adapter could not establish the connection) at`
"
you must have an incompatible version of JDBC, install the correct one:
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-10201-088211.html
|
|
|
|
|
can you please tell me the code for adding smileys in client server chatting program in java.
|
|
|
|
|
There is no such code. You need to design some smileys for yourself, and write the code in the server and client that handles them.
|
|
|
|
|