Click here to Skip to main content
15,902,835 members
Home / Discussions / Java
   

Java

 
GeneralRe: android app login issue Pin
Richard MacCutchan11-Aug-13 2:42
mveRichard MacCutchan11-Aug-13 2:42 
GeneralRe: android app login issue Pin
LawlessBaron11-Aug-13 3:27
LawlessBaron11-Aug-13 3:27 
GeneralRe: android app login issue Pin
Richard MacCutchan11-Aug-13 3:39
mveRichard MacCutchan11-Aug-13 3:39 
GeneralRe: android app login issue Pin
LawlessBaron11-Aug-13 3:47
LawlessBaron11-Aug-13 3:47 
Questionconverting problem from cmyk to rgb image Pin
Shankar nehrumaharajan7-Aug-13 3:21
Shankar nehrumaharajan7-Aug-13 3:21 
Questionhow to draw smooth curve with java? Pin
xiaobai13795-Aug-13 17:32
xiaobai13795-Aug-13 17:32 
SuggestionRe: how to draw smooth curve with java? Pin
Richard MacCutchan5-Aug-13 20:48
mveRichard MacCutchan5-Aug-13 20:48 
Questioni can't pause the song in this code Pin
Member 101909835-Aug-13 8:52
Member 101909835-Aug-13 8:52 
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.awt.event.*;
import java.net.*;
import javazoom.jl.player.*;
class Myjpanel extends JPanel implements ActionListener,Runnable
{
boolean count=true;
Thread th;
JSlider js1;
JLabel jl;
private JButton jb1,jb2;
JTextField jt1;
public SoundJLayer soundToPlay;
public Myjpanel()
{
jl=new JLabel(" ");
jb1=new JButton("Open");
jb2=new JButton("Stop");
jt1=new JTextField(20);
js1=new JSlider(1,100);
add(jt1);
this.add(jb1);
this.add(jb2);
add(js1);
js1.setValue(0);
js1.setPaintLabels(false);
jb1.addActionListener(this);
jb2.addActionListener(this);
this.add(jl);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==jb2)
{
count=true;
soundToPlay.stop1();
jl.setText(" 0 : 0 ");
}
else
{
th=new Thread(this);
if(count==true)
{

JFileChooser jfc=new JFileChooser();
File f=null;
jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);

int choice=jfc.showOpenDialog(null);

if(choice!=JFileChooser.CANCEL_OPTION)
{
f=jfc.getSelectedFile();
}
if(f==null)
JOptionPane.showMessageDialog(null,"You didn't select a file");
else
{
int option=JOptionPane.showConfirmDialog(null,"You selected "+f.getName()+"\nDo you want to open it?");

if(option==JOptionPane.YES_OPTION)
{
String str=f.getName();
jt1.setText(str);
soundToPlay= new SoundJLayer(f);
soundToPlay.play();
th.start();
count=false;
}
}
}
}
}
public void run()
{
int i=0;
for(;count==false;)
{
try
{
Thread.sleep(1000);
}
catch(InterruptedException ex)
{
}
double db1=soundToPlay.player.getPosition();
int db=(int)db1/1000;
js1.setValue(db);
db=db%60;
if(db==59)
i++;
String str1=String.valueOf(i);
String str=String.valueOf(db);
jl.setText(str1+" : "+str);

}
}
}
class Myjframe extends JFrame
{
private Myjpanel jp;
public Myjframe(String title)
{
super(title);
jp=new Myjpanel();
Container ct=getContentPane();
ct.add(jp);
setVisible(true);
setBounds(50,50,200,200);
setDefaultCloseOperation
(JFrame.EXIT_ON_CLOSE);
}
}
public class mymp3player2
{
public static void main(String[] args)

{

Myjframe obj=new Myjframe("Sumit's");
}
}
class SoundJLayer implements Runnable
{

public Player player;
public Thread playerThread;

private URL url;
public SoundJLayer(File file)
{
try
{

url=file.toURL();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}

public void play()
{
try
{


InputStream ip=url.openStream();

this.player = new Player(ip);


this.playerThread = new Thread(this, "AudioPlayerThread");


this.playerThread.start();
}
catch (Exception ex)
{
ex.printStackTrace();
}

}

public void run()
{
try
{

this.player.play();

}
catch (javazoom.jl.decoder.JavaLayerException ex)
{
ex.printStackTrace();
}

}
public void stop1()
{
this.player.close();
}
}
AnswerRe: i can't pause the song in this code Pin
Richard MacCutchan5-Aug-13 20:46
mveRichard MacCutchan5-Aug-13 20:46 
GeneralRe: i can't pause the song in this code Pin
Member 101909836-Aug-13 4:42
Member 101909836-Aug-13 4:42 
GeneralRe: i can't pause the song in this code Pin
Richard MacCutchan6-Aug-13 4:56
mveRichard MacCutchan6-Aug-13 4:56 
QuestionTwo salt Values? Pin
chdboy3-Aug-13 5:14
chdboy3-Aug-13 5:14 
AnswerRe: Two salt Values? Pin
jschell3-Aug-13 5:18
jschell3-Aug-13 5:18 
AnswerRe: Two salt Values? Pin
Bernhard Hiller4-Aug-13 22:32
Bernhard Hiller4-Aug-13 22:32 
Questionhow can i solve method RequestProcessor with using thread Pin
Zeff Portal31-Jul-13 15:39
Zeff Portal31-Jul-13 15:39 
AnswerRe: how can i solve method RequestProcessor with using thread Pin
Richard MacCutchan31-Jul-13 21:02
mveRichard MacCutchan31-Jul-13 21:02 
Questionread idmef.xml file Pin
peniya30-Jul-13 5:00
peniya30-Jul-13 5:00 
AnswerRe: read idmef.xml file Pin
Richard MacCutchan30-Jul-13 5:52
mveRichard MacCutchan30-Jul-13 5:52 
GeneralRe: read idmef.xml file Pin
peniya30-Jul-13 5:55
peniya30-Jul-13 5:55 
GeneralRe: read idmef.xml file Pin
Richard MacCutchan30-Jul-13 6:27
mveRichard MacCutchan30-Jul-13 6:27 
Questionread .csv file and write relationship between data Pin
peniya30-Jul-13 4:43
peniya30-Jul-13 4:43 
AnswerRe: read .csv file and write relationship between data Pin
Richard MacCutchan30-Jul-13 5:51
mveRichard MacCutchan30-Jul-13 5:51 
GeneralRe: read .csv file and write relationship between data Pin
peniya30-Jul-13 5:53
peniya30-Jul-13 5:53 
GeneralRe: read .csv file and write relationship between data Pin
Richard MacCutchan30-Jul-13 6:24
mveRichard MacCutchan30-Jul-13 6:24 
Questionselecting numbers that is not between double/single qoutes with regular expression Pin
mohammadkaab29-Jul-13 12:55
mohammadkaab29-Jul-13 12:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.