Created
October 30, 2016 13:22
-
-
Save LucasAlfare/c56e493959f2fd29f987bd9b48fc1775 to your computer and use it in GitHub Desktop.
Finanças test....
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package finanças.core; | |
import finanças.Gui; | |
import java.util.ArrayList; | |
/** | |
* Created by lucas on 01/10/16. | |
*/ | |
public class Core { | |
private Gui gui; | |
private ArrayList<Financa> financas; | |
public Core(Gui gui){ | |
this.gui = gui; | |
init(); | |
} | |
private void init(){ | |
financas = new ArrayList<>(); | |
eventosBotoes(); | |
eventosMenus(); | |
java.awt.EventQueue.invokeLater(() -> gui.setVisible(true)); | |
} | |
private void incluirFinanca(Financa financa){ | |
financas.add(financa); | |
} | |
private Financa getFinancaFromGui(){ | |
double valor = Double.parseDouble(gui.getPriceFin().getText()); | |
String titulo = gui.getTittleFin().getText(); | |
String descricao = gui.getDetailsFin().getText(); | |
int importancia = gui.getPrioritySpin().getValue().hashCode(); | |
if (importancia < 0){ | |
importancia = 0; | |
} | |
if (importancia > 5){ | |
importancia = 5; | |
} | |
return new Financa(valor, titulo, descricao, importancia); | |
} | |
private void eventosBotoes(){ | |
gui.getNewFin().addActionListener(e -> { | |
gui.getPriceFin().setText(""); | |
gui.getPriceFin().setEnabled(true); | |
gui.getTittleFin().setText(""); | |
gui.getTittleFin().setEnabled(true); | |
gui.getDetailsFin().setText(""); | |
gui.getDetailsFin().setEnabled(true); | |
gui.getPrioritySpin().setValue(0); | |
gui.getPrioritySpin().setEnabled(true); | |
gui.getInsertFin().setEnabled(true); | |
gui.getCancel().setEnabled(true); | |
}); | |
gui.getCancel().addActionListener(e -> { | |
gui.getPriceFin().setText(""); | |
gui.getPriceFin().setEnabled(false); | |
gui.getTittleFin().setText(""); | |
gui.getTittleFin().setEnabled(false) | |
; | |
gui.getDetailsFin().setText(""); | |
gui.getDetailsFin().setEnabled(false); | |
gui.getPrioritySpin().setValue(0); | |
gui.getPrioritySpin().setEnabled(false); | |
gui.getInsertFin().setEnabled(false); | |
gui.getCancel().setEnabled(false); | |
}); | |
gui.getInsertFin().addActionListener(e -> { | |
incluirFinanca(getFinancaFromGui()); | |
atualizarLista(financasAsArray()); | |
}); | |
} | |
private void eventosMenus(){ | |
gui.getSairMenu().addActionListener(e -> System.exit(0)); | |
gui.getSalvarEmArquivo().addActionListener(e -> new SalvarComo(financas, "kk").salvar()); | |
gui.getImportarArquivo().addActionListener(e -> { | |
financas.clear(); | |
financas = new ImportarArquivo("kk1.txt").getFinancas(); | |
atualizarLista(financasAsArray()); | |
}); | |
} | |
private void atualizarLista(String[] elementos){ | |
gui.getFinsList().setModel(new javax.swing.AbstractListModel() { | |
String[] strings = elementos; | |
public int getSize() { | |
return strings.length; | |
} | |
public Object getElementAt(int i) { | |
return strings[i]; | |
} | |
}); | |
} | |
private String[] financasAsArray(){ | |
String[] r = new String[financas.size()]; | |
for (int i = 0; i < r.length; i++){ | |
r[i] = (i + 1) + financas.get(i).toString(); | |
} | |
return r; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package finanças.core; | |
/** | |
* Created by lucas on 01/10/16. | |
*/ | |
public class Financa { | |
private double valor; | |
private String titulo, descricao; | |
private int importancia; | |
public Financa(double valor, String titulo, String descricao, int importancia){ | |
this.valor = valor; | |
this.titulo = titulo; | |
this.descricao = descricao; | |
this.importancia = importancia; | |
} | |
public String completa(){ | |
return "[valor]" + valor + "[valor] [titulo]" + titulo + " [titulo](" + importancia + ")" + "\n" + descricao + ";"; | |
} | |
public double getValor() { | |
return valor; | |
} | |
public String getTitulo() { | |
return titulo; | |
} | |
public String getDescricao() { | |
return descricao; | |
} | |
public int getImportancia() { | |
return importancia; | |
} | |
@Override | |
public String toString() { | |
return "(" + valor + ") - " + titulo + " - (" + importancia + ")"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package finanças.core; | |
import javax.swing.*; | |
import java.io.BufferedReader; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
/** | |
* Created by lucas on 01/10/16. | |
*/ | |
public class ImportarArquivo { | |
private String nome; | |
public ImportarArquivo(String nome){ | |
this.nome = nome; | |
} | |
public ArrayList<Financa> getFinancas(){ | |
ArrayList<Financa> r = new ArrayList<>(); | |
try{ | |
FileInputStream arquivo = new FileInputStream(nome); | |
InputStreamReader inputStreamReader = new InputStreamReader(arquivo); | |
BufferedReader bufferedReader = new BufferedReader(inputStreamReader); | |
for (double x : getValores(arquivo, inputStreamReader, bufferedReader)){ | |
r.add(new Financa(x, null, null, 0)); | |
} | |
bufferedReader.close(); | |
inputStreamReader.close(); | |
arquivo.close(); | |
JOptionPane.showMessageDialog(null, "Finanças importadas com sucesso!!!"); | |
} catch (Exception e){ | |
JOptionPane.showMessageDialog(null, "DEU ERRO!!!!!!!!!!!!"); | |
} | |
return r; | |
} | |
private String[] itens(FileInputStream arquivo, InputStreamReader inputStreamReader, BufferedReader bufferedReader) throws IOException { | |
String aux; | |
do { | |
aux = bufferedReader.readLine(); | |
System.out.println(aux); | |
} while (aux != null); | |
return aux.split(";"); | |
} | |
private double[] getValores(FileInputStream arquivo, InputStreamReader inputStreamReader, BufferedReader bufferedReader) throws IOException { | |
String aux = ""; | |
ArrayList<String> linesList = new ArrayList<>(); | |
do { | |
linesList.add(bufferedReader.readLine()); | |
} while (bufferedReader.readLine() != null); | |
for (String x : linesList){ | |
aux += x; | |
} | |
String[] aux2 = aux.split(";"); | |
double[] r = new double[aux2.length]; | |
for (int i = 0; i < r.length; i++){ | |
r[i] = Double.parseDouble(aux2[i]); | |
} | |
return r; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package finanças.core; | |
import javax.swing.*; | |
import java.io.FileOutputStream; | |
import java.io.PrintWriter; | |
import java.util.ArrayList; | |
/** | |
* Created by lucas on 01/10/16. | |
*/ | |
public class SalvarComo { | |
private ArrayList<Financa> financas; | |
private String nome; | |
public SalvarComo(ArrayList<Financa> financas, String nome){ | |
this.financas = financas; | |
this.nome = nome; | |
} | |
public void salvar(){ | |
try { | |
FileOutputStream valoresFile = new FileOutputStream(nome + 1 + ".txt"); | |
PrintWriter valoresWriter = new PrintWriter(valoresFile); | |
FileOutputStream titulosFile = new FileOutputStream(nome + 2 + ".txt"); | |
PrintWriter titulosWriter = new PrintWriter(titulosFile); | |
FileOutputStream descricaoFile = new FileOutputStream(nome + 3 + ".txt"); | |
PrintWriter descricoesWriter = new PrintWriter(descricaoFile); | |
FileOutputStream importanciaFile = new FileOutputStream(nome + 4 + ".txt"); | |
PrintWriter importanciasWriter = new PrintWriter(importanciaFile); | |
for (double x : getValores()){ | |
valoresWriter.println(x + ";"); | |
} | |
for (String x : getTitulos()){ | |
titulosWriter.println(x + ";"); | |
} | |
for (String x : getDescricoes()){ | |
descricoesWriter.println(x + ";"); | |
} | |
for (int x : getImportancias()){ | |
importanciasWriter.println(x + ";"); | |
} | |
valoresWriter.close(); | |
valoresFile.close(); | |
titulosWriter.close(); | |
titulosFile.close(); | |
descricoesWriter.close(); | |
descricaoFile.close(); | |
importanciasWriter.close(); | |
importanciaFile.close(); | |
JOptionPane.showMessageDialog(null, "Arquivo Gravado!"); | |
} catch (Exception e){ | |
JOptionPane.showMessageDialog(null, "Ocorreu um erro e o arquivo não foi gravado."); | |
} | |
} | |
private String[] financasAsArray(){ | |
String[] r = new String[financas.size()]; | |
for (int i = 0; i < r.length; i++){ | |
r[i] = financas.get(i).completa(); | |
} | |
return r; | |
} | |
private double[] getValores(){ | |
double[] r = new double[financas.size()]; | |
for (int i = 0; i < r.length; i++){ | |
r[i] = financas.get(i).getValor(); | |
} | |
return r; | |
} | |
private String[] getTitulos(){ | |
String[] r = new String[financas.size()]; | |
for (int i = 0; i < r.length; i++){ | |
r[i] = financas.get(i).getTitulo(); | |
} | |
return r; | |
} | |
private String[] getDescricoes(){ | |
String[] r = new String[financas.size()]; | |
for (int i = 0; i < r.length; i++){ | |
r[i] = financas.get(i).getDescricao(); | |
} | |
return r; | |
} | |
private int[] getImportancias(){ | |
int[] r = new int[financas.size()]; | |
for (int i = 0; i < r.length; i++){ | |
r[i] = financas.get(i).getImportancia(); | |
} | |
return r; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package finanças; | |
import javax.swing.*; | |
/** | |
* | |
* @author lucas | |
*/ | |
public class Gui extends javax.swing.JFrame { | |
/** | |
* Creates new form Gui | |
*/ | |
public Gui() { | |
initComponents(); | |
getPriceFin().setText(""); | |
getPriceFin().setEnabled(false); | |
getTittleFin().setText(""); | |
getTittleFin().setEnabled(false); | |
getDetailsFin().setText(""); | |
getDetailsFin().setEnabled(false); | |
getPrioritySpin().setValue(0); | |
getPrioritySpin().setEnabled(false); | |
getInsertFin().setEnabled(false); | |
getCancel().setEnabled(false); | |
} | |
@SuppressWarnings("unchecked") | |
private void initComponents() { | |
jMenuItem4 = new javax.swing.JMenuItem(); | |
jPanel1 = new javax.swing.JPanel(); | |
reduceFin = new javax.swing.JButton(); | |
jScrollPane1 = new javax.swing.JScrollPane(); | |
finsList = new javax.swing.JList(); | |
incrementFin = new javax.swing.JButton(); | |
delFin = new javax.swing.JButton(); | |
newFin = new javax.swing.JButton(); | |
lookFin = new javax.swing.JButton(); | |
jPanel2 = new javax.swing.JPanel(); | |
insertFin = new javax.swing.JButton(); | |
cancel = new javax.swing.JButton(); | |
jLabel1 = new javax.swing.JLabel(); | |
prioritySpin = new javax.swing.JSpinner(); | |
jLabel2 = new javax.swing.JLabel(); | |
priceFin = new javax.swing.JTextField(); | |
scrollPane = new javax.swing.JScrollPane(); | |
detailsFin = new javax.swing.JTextArea(); | |
jLabel4 = new javax.swing.JLabel(); | |
tittleFin = new javax.swing.JTextField(); | |
jSeparator2 = new javax.swing.JSeparator(); | |
log = new javax.swing.JLabel(); | |
jMenuBar1 = new javax.swing.JMenuBar(); | |
jMenu1 = new javax.swing.JMenu(); | |
salvarEmArquivo = new javax.swing.JMenuItem(); | |
exportarKkkk = new javax.swing.JMenuItem(); | |
importarArquivo = new javax.swing.JMenuItem(); | |
balancoMenu = new javax.swing.JMenuItem(); | |
sairMenu = new javax.swing.JMenuItem(); | |
jSeparator1 = new javax.swing.JPopupMenu.Separator(); | |
editMenu = new javax.swing.JMenu(); | |
editarValorInicialMenu = new javax.swing.JMenuItem(); | |
jMenuItem4.setText("jMenuItem4"); | |
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | |
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); | |
reduceFin.setBackground(new java.awt.Color(222, 222, 35)); | |
reduceFin.setText("<html>Reduzir<br />Importância"); | |
reduceFin.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); | |
finsList.setBorder(javax.swing.BorderFactory.createTitledBorder("Finanças Salvas")); | |
finsList.setModel(new javax.swing.AbstractListModel() { | |
String[] strings = { "[vazio]" }; | |
public int getSize() { return strings.length; } | |
public Object getElementAt(int i) { return strings[i]; } | |
}); | |
jScrollPane1.setViewportView(finsList); | |
incrementFin.setBackground(new java.awt.Color(26, 109, 192)); | |
incrementFin.setText("<html>Incrementar<br />Importância"); | |
delFin.setBackground(new java.awt.Color(255, 12, 0)); | |
delFin.setText("<html>Remover<br />Finança"); | |
newFin.setBackground(new java.awt.Color(237, 144, 65)); | |
newFin.setText("<html>Nova<br /> Finança"); | |
newFin.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); | |
lookFin.setText("<html>Ver<br/>Detalhes"); | |
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); | |
jPanel1.setLayout(jPanel1Layout); | |
jPanel1Layout.setHorizontalGroup( | |
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel1Layout.createSequentialGroup() | |
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) | |
.addComponent(incrementFin) | |
.addComponent(newFin) | |
.addComponent(reduceFin) | |
.addComponent(delFin) | |
.addComponent(lookFin)) | |
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
); | |
jPanel1Layout.setVerticalGroup( | |
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel1Layout.createSequentialGroup() | |
.addContainerGap() | |
.addComponent(newFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(37, 37, 37) | |
.addComponent(delFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE) | |
.addComponent(incrementFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(34, 34, 34) | |
.addComponent(reduceFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addGap(33, 33, 33) | |
.addComponent(lookFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addContainerGap()) | |
.addComponent(jScrollPane1) | |
); | |
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Nova finança")); | |
insertFin.setBackground(new java.awt.Color(51, 206, 106)); | |
insertFin.setText("Incluir"); | |
cancel.setBackground(java.awt.Color.red); | |
cancel.setText("Cancelar"); | |
jLabel1.setText("Importância:"); | |
jLabel2.setText("Gasto:"); | |
priceFin.setText("R$ 0,00"); | |
scrollPane.setBorder(javax.swing.BorderFactory.createTitledBorder("Descrição")); | |
detailsFin.setColumns(20); | |
detailsFin.setRows(5); | |
scrollPane.setViewportView(detailsFin); | |
jLabel4.setText("Título:"); | |
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); | |
jPanel2.setLayout(jPanel2Layout); | |
jPanel2Layout.setHorizontalGroup( | |
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addComponent(scrollPane) | |
.addGroup(jPanel2Layout.createSequentialGroup() | |
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel2Layout.createSequentialGroup() | |
.addComponent(jLabel2) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(priceFin)) | |
.addGroup(jPanel2Layout.createSequentialGroup() | |
.addComponent(insertFin, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(cancel, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(jLabel1) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(prioritySpin, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
.addGroup(jPanel2Layout.createSequentialGroup() | |
.addComponent(jLabel4) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(tittleFin))) | |
.addContainerGap()) | |
); | |
jPanel2Layout.setVerticalGroup( | |
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(jPanel2Layout.createSequentialGroup() | |
.addContainerGap() | |
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
.addComponent(jLabel4) | |
.addComponent(tittleFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
.addComponent(jLabel2) | |
.addComponent(priceFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
.addComponent(scrollPane) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
.addComponent(insertFin) | |
.addComponent(cancel) | |
.addComponent(jLabel1) | |
.addComponent(prioritySpin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
.addContainerGap()) | |
); | |
log.setFont(new java.awt.Font("Ubuntu", 1, 12)); // NOI18N | |
log.setText("Log."); | |
jMenu1.setText("Arquivo"); | |
salvarEmArquivo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); | |
salvarEmArquivo.setText("Salvar finanças"); | |
jMenu1.add(salvarEmArquivo); | |
exportarKkkk.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK)); | |
exportarKkkk.setText("Exportar finanças"); | |
jMenu1.add(exportarKkkk); | |
importarArquivo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK)); | |
importarArquivo.setText("Importar finanças"); | |
jMenu1.add(importarArquivo); | |
balancoMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.CTRL_MASK)); | |
balancoMenu.setText("Obter balanço"); | |
jMenu1.add(balancoMenu); | |
sairMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK)); | |
sairMenu.setText("Sair"); | |
jMenu1.add(sairMenu); | |
jMenu1.add(jSeparator1); | |
jMenuBar1.add(jMenu1); | |
editMenu.setText("Editar"); | |
editarValorInicialMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK)); | |
editarValorInicialMenu.setText("Definir dinheiro total"); | |
editMenu.add(editarValorInicialMenu); | |
jMenuBar1.add(editMenu); | |
setJMenuBar(jMenuBar1); | |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
getContentPane().setLayout(layout); | |
layout.setHorizontalGroup( | |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
.addGroup(layout.createSequentialGroup() | |
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 386, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
.addComponent(jSeparator2) | |
.addComponent(log, 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() | |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) | |
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
.addComponent(log) | |
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
); | |
pack(); | |
}// </editor-fold> | |
/* | |
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(Gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} catch (InstantiationException ex) { | |
java.util.logging.Logger.getLogger(Gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} catch (IllegalAccessException ex) { | |
java.util.logging.Logger.getLogger(Gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} catch (javax.swing.UnsupportedLookAndFeelException ex) { | |
java.util.logging.Logger.getLogger(Gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} | |
java.awt.EventQueue.invokeLater(new Runnable() { | |
public void run() { | |
new Gui().setVisible(true); | |
} | |
}); | |
} | |
*/ | |
public JButton getCancel() { | |
return cancel; | |
} | |
public JMenu getEditMenu() { | |
return editMenu; | |
} | |
public JButton getDelFin() { | |
return delFin; | |
} | |
public JMenuItem getSalvarEmArquivo() { | |
return salvarEmArquivo; | |
} | |
public JList getFinsList() { | |
return finsList; | |
} | |
public JMenuItem getBalancoMenu() { | |
return balancoMenu; | |
} | |
public JMenuItem getExportarKkkk() { | |
return exportarKkkk; | |
} | |
public JButton getIncrementFin() { | |
return incrementFin; | |
} | |
public JButton getInsertFin() { | |
return insertFin; | |
} | |
public JLabel getLog() { | |
return log; | |
} | |
public JButton getLookFin() { | |
return lookFin; | |
} | |
public JButton getNewFin() { | |
return newFin; | |
} | |
public JTextField getPriceFin() { | |
return priceFin; | |
} | |
public JSpinner getPrioritySpin() { | |
return prioritySpin; | |
} | |
public JMenuItem getSairMenu() { | |
return sairMenu; | |
} | |
public JButton getReduceFin() { | |
return reduceFin; | |
} | |
public JTextField getTittleFin() { | |
return tittleFin; | |
} | |
public JTextArea getDetailsFin() { | |
return detailsFin; | |
} | |
public JMenuItem getImportarArquivo() { | |
return importarArquivo; | |
} | |
// Variables declaration - do not modify | |
private javax.swing.JButton cancel; | |
private javax.swing.JMenu editMenu; | |
private javax.swing.JButton delFin; | |
private javax.swing.JScrollPane scrollPane; | |
private javax.swing.JMenuItem salvarEmArquivo; | |
private javax.swing.JList finsList; | |
private javax.swing.JMenuItem balancoMenu; | |
private javax.swing.JMenuItem exportarKkkk; | |
private javax.swing.JButton incrementFin; | |
private javax.swing.JButton insertFin; | |
private javax.swing.JLabel jLabel1; | |
private javax.swing.JLabel jLabel2; | |
private javax.swing.JLabel jLabel4; | |
private javax.swing.JMenu jMenu1; | |
private javax.swing.JMenuBar jMenuBar1; | |
private javax.swing.JMenuItem importarArquivo; | |
private javax.swing.JMenuItem jMenuItem4; | |
private javax.swing.JMenuItem editarValorInicialMenu; | |
private javax.swing.JPanel jPanel1; | |
private javax.swing.JPanel jPanel2; | |
private javax.swing.JScrollPane jScrollPane1; | |
private javax.swing.JPopupMenu.Separator jSeparator1; | |
private javax.swing.JSeparator jSeparator2; | |
private javax.swing.JTextArea detailsFin; | |
private javax.swing.JLabel log; | |
private javax.swing.JButton lookFin; | |
private javax.swing.JButton newFin; | |
private javax.swing.JTextField priceFin; | |
private javax.swing.JSpinner prioritySpin; | |
private javax.swing.JMenuItem sairMenu; | |
private javax.swing.JButton reduceFin; | |
private javax.swing.JTextField tittleFin; | |
// End of variables declaration | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package finanças; | |
import finanças.core.Core; | |
/** | |
* Created by lucas on 01/10/16. | |
*/ | |
public class Main { | |
public static void main(String[] args) { | |
setNimbusTheme(); | |
new Core(new Gui()); | |
} | |
public static void setNimbusTheme(){ | |
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(Gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} catch (InstantiationException ex) { | |
java.util.logging.Logger.getLogger(Gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} catch (IllegalAccessException ex) { | |
java.util.logging.Logger.getLogger(Gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} catch (javax.swing.UnsupportedLookAndFeelException ex) { | |
java.util.logging.Logger.getLogger(Gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment