Questions tagged as 'java'

1
answer

Error with GET HTTP Special Characters

I have some problems when making HTTP GETs. When the page text has a special character, the response becomes distorted. Example: os participantes deverão: when the original text was os participantes deverão...
asked by 28.12.2015 / 19:12
1
answer

Show text in JFrame

I would like to know how I can put text in my Java class, but this text would have the contents of a record in my database. I've done more or less this using JLabel but it creates one-line labels and would like to create multi-line runnin...
asked by 13.11.2016 / 22:38
1
answer

What's the difference between creating a Socket via SocketFactory and creating one with new Socket?

I was studying on Sockets and saw that some people were creating sockets with SocketFactory (javax). I've always created this: Socket skt = new Socket(host, port); In the example it looked like this: Socket s = SocketFactory.g...
asked by 12.10.2015 / 21:17
1
answer

How to run multiple threads sequentially?

I have to execute an x thread and let the y thread start only when x terminates regardless of the time it will take, and then execute z only when a and terminate. Anyone know what the best way to do this? Thank you in advance.     
asked by 30.10.2015 / 21:08
3
answers

Determine the page where the * .pdf file will open in the browser

I have a code to display a pdf file: @WebServlet(urlPatterns = {"/teste"}) public class abrirPDF extends HttpServlet { byte[] arquivo = null; File file = new File("C:\testes\teste.pdf"); protected void service(HttpServletRequest...
asked by 19.08.2016 / 20:00
1
answer

How do I use foreach to print information from an object array? (Java)

Good evening! I have this structure below and would like to know how I could use a for each to print the information for this vector. public static void main(String[] args) { Scanner teclado = new Scanner(System.in); Funcionario fu...
asked by 22.08.2016 / 09:09
2
answers

What is the reason for the error "The operator / is undefined for the argument" in this code?

double t1 = System.currentTimeMillis(); double t2 = System.currentTimeMillis(); System.out.print("\n Tempo Total: "+ (t2-t1)/Double.valueOf(1000)+ " segundos"); When compiling the third line, corresponding to System.out.println , gives...
asked by 27.08.2016 / 04:25
2
answers

How do I create notifications?

I'm making apps just to test some functions for Android and would like to know how to create notifications in the status bar. My Java code and a default code that only calls the XML file: package com.bandicootapps.nav; import android.app.*...
asked by 03.09.2016 / 14:33
1
answer

How to access the Serial Port of a computer in Java?

How do I access / control a Serial Port through Java? Currently I got access in C ++, however, in Java I do not know how to do it. Any suggestions?     
asked by 15.07.2015 / 19:22
1
answer

Java Printing - DocPrintJob

I have this method to do printing: public void imprimir(String texto) { PrintService[] printService = PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.AUTOSENSE, null); PrintService impressoraPadrao = PrintServiceLookup.lo...
asked by 23.05.2016 / 19:34