Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search Coderanch
Advance search
Google search
Register / Login
paul beppe
Ranch Hand
+ Follow
news
82
Posts
36
Threads
since Aug 09, 2012
Merit badge:
grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads
Recent posts by paul beppe
javafx control textfield
hello friends!
for to do control to TextField in javafx i write this code:
final TextField testo = new TextField(); Button btn = new Button("Apri"); btn.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent evt) { if (testo.equals("") || testo.getText()=="" || testo.getText()== null) { System.out.println("Errore"); }else { System.out.println("Hello Firends"); } } });
with this code don't to do the control!
why??
help!
show more
10 years ago
JavaFX
creating db and table in java
for create db in java i write this code:
private void createDatabase() { try { Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/?user=root&password=root"); st = conn.createStatement(); int myResult = st.executeUpdate("CREATE DATABASE IF NOT EXISTS mydb2"); System.out.println("Database created !"); } catch (ClassNotFoundException | SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
and it's ok!!
for create table i have problems..this is code:
private void createTable() { try { String table = "create table IF NOT EXISTS persone (" + "id INT( 10 ) NOT NULL PRIMARY KEY AUTO_INCREMENT," + "nome varchar(50)," + "cognome varchar(50),"; Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb2","root", "root"); st = conn.createStatement(); st.execute(table); System.out.println("Table created !"); } catch (ClassNotFoundException | SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
i have this error:
Database created !
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
help!!
show more
10 years ago
JDBC and Relational Databases
javafx jdbc problems with delete
hi!
thank's for answer
i edit code:
int id = persone.getID(); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb","root", "root"); String query = "Delete from persone where id ="+id; ps = (PreparedStatement) conn.prepareStatement(query); ps.setInt(1, id); ps.executeUpdate();
show this error:
Parameter index out of range (1 > number of parameters, which is 0).
help!
show more
10 years ago
JDBC and Relational Databases
javafx jdbc problems with delete
hi friends in javafx i have problems with delete in delete row selected.
i have write this code:
//String deleteString = idModifica.getText().toString(); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb","root", "root"); int deleteString = persone.getID(); String query = "Delete from persone where id ="+deleteString; ps = (PreparedStatement) conn.prepareStatement(query); ps.executeUpdate();
don't delete row selected!! where is the problem???
help me please!
show more
10 years ago
JDBC and Relational Databases
javafx ListView
hi!!!
for show list of my database i write this code:
try { Persone persone = new Persone(); Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance(); conn = DriverManager.getConnection("jdbc:derby://localhost:1527/db"); ps = conn.prepareStatement("select * from persone"); ObservableList<Persone> observableList = FXCollections.observableArrayList(); list = new ListView(observableList); rs = ps.executeQuery(); while(rs.next()){ //persone.seId(rs.getInt(1)); persone.setNome(rs.getString(2)); //persone.setCognome(rs.getString(3)); observableList.add(persone); } } catch (Exception ex) { ex.printStackTrace(); } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } if (conn != null) { conn.close(); } } catch (Exception e) { e.printStackTrace(); } }
when open, show this:
Persone@42343
Persone@45234
why???
where is the error???
show more
10 years ago
JavaFX
javafx database....
hi i want create one "CRUD" with sqlite on javafx!!!
how to to in javafx???
there is one guide???
help me please!!!
show more
10 years ago
JavaFX
JEditorPane show image when event click on href
hi!!!
i'm write in another code....
import java.awt.BorderLayout; import java.awt.Color; import java.awt.Desktop; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Insets; import java.awt.Toolkit; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTextArea; import javax.swing.JTextPane; import javax.swing.UIManager; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import javax.swing.text.AttributeSet; import javax.swing.text.Element; import javax.swing.text.html.HTML; import javax.swing.text.html.HTMLDocument; public class SplitPane extends JFrame { private JSplitPane splitPaneV; private JSplitPane splitPaneH; private JPanel panel1; private JPanel panel2; JEditorPane jep; JLabel label = new JLabel(); ImageIcon image; JFrame frame; public SplitPane(){ setTitle("Esempio Click"); setBackground( Color.gray ); JPanel topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel ); // Create the panels createPanel1(); //createPanel2(); // Create a splitter pane splitPaneV = new JSplitPane(JSplitPane.VERTICAL_SPLIT); topPanel.add(splitPaneV, BorderLayout.CENTER); splitPaneH = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPaneH.setLeftComponent(panel1); splitPaneV.setLeftComponent( splitPaneH ); splitPaneV.setRightComponent(panel2); } public void createPanel1(){ panel1 = new JPanel(); panel1.setLayout( new BorderLayout() ); String path = "c://image.jpg"; String name = "link"; jep = new JTextPane(); JScrollPane scrollPane = new JScrollPane(jep); panel1.add(scrollPane); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); jep.setContentType("text/html"); jep.setEditable(false); //jep.setText("<a href=\"c://image.jpg\">a link</a>"); jep.setText("<a href=\"+"+path+"\">"+name+"</a>"); jep.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { showImage(); } } }); } public void showImage(){ JPanel panel = new JPanel(); panel.setLayout( new BorderLayout()); panel.setPreferredSize( new Dimension( 600, 300 ) ); image = new ImageIcon("c://image.jpg"); label = new JLabel("", image, JLabel.CENTER); panel.add( label, BorderLayout.CENTER ); frame = new JFrame ("Preview Image"); frame.setSize(600, 400); // centra il frame frame.setLocationRelativeTo(null); frame.getContentPane().add(panel); frame.setVisible(false); frame.dispose(); frame.setVisible(true); } public void createPanel2(){ panel2 = new JPanel(); panel2.setLayout( new BorderLayout()); panel2.setPreferredSize( new Dimension( 600, 300 ) ); image = new ImageIcon("c://image.jpg"); label = new JLabel("", image, JLabel.CENTER); panel2.add( label, BorderLayout.CENTER ); } public static void main( String args[] ){ SplitPane splitFrame = new SplitPane(); splitFrame.pack(); splitFrame.setVisible( true ); } }
but the problems is in database....
for insert in database i write this code:
chooser = (JFileChooser)actionEvent.getSource(); String command = actionEvent.getActionCommand(); if (command.equals(JFileChooser.APPROVE_SELECTION)) { File[] files = chooser.getSelectedFiles(); String path = chooser.getSelectedFile().getAbsolutePath(); for(int i=0;i<=files.length-1;i++) { String name = files[i].getName(); foto.setEditable(false); foto.setContentType("text/html"); foto.setText(files[i].getName()+"\n"); foto.setText("<a href=\"+"+path+"\">"+name+"</a>"); } JOptionPane.showMessageDialog(null, "Photo Added!", "Message...",JOptionPane.INFORMATION_MESSAGE ); } else if (command.equals(JFileChooser.CANCEL_SELECTION)) { chooser.removeAll(); System.gc(); }
but if i want show image with path how to do???
i have problem when i want show image relative to path...
how to do???
show more
10 years ago
Swing / AWT / SWT
JEditorPane show image when event click on href
hi!!!
i want show one image when i click on one "href"
i have write this code....
import java.awt.BorderLayout; import java.awt.Color; import java.awt.Desktop; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTextArea; import javax.swing.JTextPane; import javax.swing.UIManager; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import javax.swing.text.AttributeSet; import javax.swing.text.Element; import javax.swing.text.html.HTML; import javax.swing.text.html.HTMLDocument; public class SplitPane extends JFrame { private JSplitPane splitPaneV; private JSplitPane splitPaneH; private JPanel panel1; private JPanel panel2; JEditorPane jep; JLabel label = new JLabel(); ImageIcon image; public SplitPane(){ setTitle("Esempio Click"); setBackground( Color.gray ); JPanel topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel ); // Create the panels createPanel1(); createPanel2(); // Create a splitter pane splitPaneV = new JSplitPane(JSplitPane.VERTICAL_SPLIT); topPanel.add(splitPaneV, BorderLayout.CENTER); splitPaneH = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPaneH.setLeftComponent(panel1); splitPaneV.setLeftComponent( splitPaneH ); splitPaneV.setRightComponent(panel2); } public void createPanel1(){ panel1 = new JPanel(); panel1.setLayout( new BorderLayout() ); jep = new JTextPane(); JScrollPane scrollPane = new JScrollPane(jep); panel1.add(scrollPane); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); jep.setContentType("text/html"); jep.setEditable(false); jep.setText("<a href=\"c://image.jpg\">a link</a>"); jep.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { image = new ImageIcon("c://equalizer.jpg"); label = new JLabel("", image, JLabel.CENTER); panel2.add( label, BorderLayout.CENTER ); /*if(Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(e.getURL().toURI()); } catch (IOException | URISyntaxException e1) { e1.printStackTrace(); } }*/ } } }); } public void createPanel2(){ panel2 = new JPanel(); panel2.setLayout( new BorderLayout()); panel2.setPreferredSize( new Dimension( 600, 300 ) ); image = new ImageIcon("c://image.jpg"); label = new JLabel("", image, JLabel.CENTER); panel2.add( label, BorderLayout.CENTER ); } public static void main( String args[] ){ SplitPane splitFrame = new SplitPane(); splitFrame.pack(); splitFrame.setVisible( true ); } }
help me please....
show more
10 years ago
Swing / AWT / SWT
android isShuffle
I would like to mix the order of the list of songs .....
show more
10 years ago
Android
android isShuffle
HI!!!
i want create one Shuffle for songs....
for goto next i write this code:
if (album_id != null) { mNextSongData = mGetSong.getNextAlbumSongData(song_title,album_id); } else { mNextSongData = mGetSong.getNextSongData(song_title); } song_title = mNextSongData[0]; song_path = mNextSongData[1]; artist = mNextSongData[2]; titleText.setText(song_title); artistText.setText(artist); mp.stop(); music_seekbar.setProgress(0); if (!mp.isPlaying()) { btnPlay.setImageResource(R.drawable.img_btn_pause); } if (song_path != null) { setAlbumCover(); } play(0);
how can to to use the isShuffle??
help me please!!!
show more
10 years ago
Android
JFilechooser event double click problems
in this site web
http://stackoverflow.com/questions/10232281/java-jfilechooser-returns-the-selected-directory-instead-of-browsing-it
there is one example
bat i have problem...
help me please!!!
i want open file in jfilechooser with double click
show more
10 years ago
Swing / AWT / SWT
JFilechooser event double click problems
i want show message with double click on JFileChooser and i have add Listener in chooser...
show more
10 years ago
Swing / AWT / SWT
JFilechooser event double click problems
how to do???
i don't understand my problem
i have add Listener for show message and later add name of file selected in JTextArea....
help me please!!!
show more
10 years ago
Swing / AWT / SWT
JFilechooser event double click problems
hi!!!
don't show message when i click in jfilechoooser
this is code:
chooser = new JFileChooser("."); chooser.setControlButtonsAreShown(false); PreviewPane previewPane = new PreviewPane(); chooser.setDialogTitle("Selezionare il File d'Immagine"); chooser.setAccessory(previewPane); chooser.setMultiSelectionEnabled(true); chooser.addPropertyChangeListener(previewPane); FileNameExtensionFilter filter = new FileNameExtensionFilter("Foto", "jpeg", "jpg", "png", "gif","bmp"); chooser.setFileFilter(filter); chooser.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if(e.getClickCount() == 2) { File file = chooser.getSelectedFile(); JOptionPane.showMessageDialog(null, "ciao", "Messaggio", JOptionPane.WARNING_MESSAGE); } } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } });
where is the problems???
show more
10 years ago
Swing / AWT / SWT
Android link donation
trovato!!!
thank's!!!
very much!!!
show more
10 years ago
Android