one.empty3.neuralnetwork.of.NeuronsUI1 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of empty3-library-3d Show documentation
Show all versions of empty3-library-3d Show documentation
3D rendering engine. Plus modelling. Expected glsl textures 3d and 2d rendering3D primitives, and a lot of scenes' samples to test.+ Game Jogl reworked, Calculator (numbers and vectors). Java code parser implementation starts (<=1.2)
The newest version!
/*
*
* * Copyright (c) 2024. Manuel Daniel Dahmen
* *
* *
* * Copyright 2024 Manuel Daniel Dahmen
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*
*/
package one.empty3.neuralnetwork.of;
/*
import java.awt.*;
import atlasgen.Action;
import atlasgen.CsvLine;
import atlasgen.CsvReader;
import atlasgen.CsvWriter;
import com.intellij.uiDesigner.core.*;
import one.empty3.neuralnetwork.Main;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
public class NeuronsUI1 {
private static JRootPane rootPane;
private static JFrame frame;
private String csv;
private int startIndex = 0;
private int pageSize = 20;
CsvLine csvLineSelected;
private List csvValues = new ArrayList<>();
private CsvReader reader;
public NeuronsUI1() {
initComponents();
parcourirButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser chooser = new JFileChooser(new File(csv));
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.showDialog(frame, "Select");
if (chooser.getSelectedFile() != null) {
csv = chooser.getCurrentDirectory().getAbsolutePath();
populate();
}
}
});
listImages.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
ListModel objects = listImages.getModel();
Object elementAt = objects.getElementAt(listImages.getSelectedIndex());
String idStr = (String) elementAt;
reader = new CsvReader(new File(csv), "\t", "\n", false);
reader.setAction(new Action() {
String id = idStr;
@Override
public void init() {
}
@Override
public void processLine(CsvLine csvLine) {
if (csvLine.getValue()[0].equals(id)) {
csvLineSelected = csvLine;
}
}
});
}
});
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
CsvWriter writer = new CsvWriter("\n", "\t");
writer.openFile(new File(csv));
}
});
}
private void populate() {
Vector listData = new Vector();
reader = new CsvReader(new File(csv), "\t", "\n", false);
reader.setAction(new Action() {
int i = 0;
@Override
public void init() {
}
@Override
public void processLine(CsvLine csvLine) {
i++;
if (i >= startIndex && i < startIndex + pageSize) {
String s = csvLine.getValue()[0];
listData.add(s);
}
}
});
listImages.setListData(listData);
}
public static void main(String[] args) {
frame = new JFrame("Test");
rootPane = new Main().getRootPane();
frame.setContentPane(rootPane);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.pack();
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
// Generated using JFormDesigner non-commercial license
var panel1 = new JPanel();
var panel2 = new JPanel();
parcourirButton = new JButton();
var label1 = new JLabel();
var label2 = new JLabel();
var label3 = new JLabel();
var label4 = new JLabel();
var label5 = new JLabel();
textField1 = new JTextField();
textField2 = new JTextField();
textField3 = new JTextField();
textField4 = new JTextField();
var hSpacer1 = new Spacer();
labels = new JList();
imagePanel = new JPanel();
saveAsButton = new JButton();
reloadButton = new JButton();
saveButton = new JButton();
var panel3 = new JPanel();
listImages = new JList();
var hSpacer2 = new Spacer();
rectangles = new JList();
precedentButton = new JButton();
suivantButton = new JButton();
//======== panel1 ========
{
panel1.setLayout(new GridLayoutManager(5, 4, new Insets(0, 0, 0, 0), -1, -1));
//======== panel2 ========
{
panel2.setLayout(new GridLayoutManager(5, 2, new Insets(0, 0, 0, 0), -1, -1));
//---- parcourirButton ----
parcourirButton.setText("Parcourir");
panel2.add(parcourirButton, new GridConstraints(0, 1, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
//---- label1 ----
label1.setText("Label");
panel2.add(label1, new GridConstraints(0, 0, 1, 1,
GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
//---- label2 ----
label2.setText("id");
panel2.add(label2, new GridConstraints(1, 0, 1, 1,
GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
//---- label3 ----
label3.setText("file");
panel2.add(label3, new GridConstraints(2, 0, 1, 1,
GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
//---- label4 ----
label4.setText("rectangles");
panel2.add(label4, new GridConstraints(3, 0, 1, 1,
GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
//---- label5 ----
label5.setText("labels");
panel2.add(label5, new GridConstraints(4, 0, 1, 1,
GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
panel2.add(textField1, new GridConstraints(1, 1, 1, 1,
GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
panel2.add(textField2, new GridConstraints(2, 1, 1, 1,
GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
panel2.add(textField3, new GridConstraints(3, 1, 1, 1,
GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
panel2.add(textField4, new GridConstraints(4, 1, 1, 1,
GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
}
panel1.add(panel2, new GridConstraints(0, 1, 2, 2,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
null, null, null));
panel1.add(hSpacer1, new GridConstraints(1, 3, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK,
null, null, null));
panel1.add(labels, new GridConstraints(3, 2, 2, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
null, new Dimension(74, 50), null));
//======== imagePanel ========
{
imagePanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
}
panel1.add(imagePanel, new GridConstraints(0, 3, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
null, null, null));
//---- saveAsButton ----
saveAsButton.setText("Save as");
panel1.add(saveAsButton, new GridConstraints(3, 3, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
//---- reloadButton ----
reloadButton.setText("Reload");
panel1.add(reloadButton, new GridConstraints(4, 3, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
//---- saveButton ----
saveButton.setText("Save");
panel1.add(saveButton, new GridConstraints(2, 3, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, null, null));
//======== panel3 ========
{
panel3.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
panel3.add(listImages, new GridConstraints(0, 1, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
null, new Dimension(150, 50), null));
panel3.add(hSpacer2, new GridConstraints(0, 0, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK,
null, null, null));
}
panel1.add(panel3, new GridConstraints(0, 0, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
null, new Dimension(185, 24), null));
panel1.add(rectangles, new GridConstraints(3, 1, 2, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
null, new Dimension(330, 50), null));
//---- precedentButton ----
precedentButton.setText("Precedent");
panel1.add(precedentButton, new GridConstraints(1, 0, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, new Dimension(330, 30), null));
//---- suivantButton ----
suivantButton.setText("Suivant");
panel1.add(suivantButton, new GridConstraints(2, 0, 1, 1,
GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED,
null, new Dimension(74, 30), null));
}
// JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
// Generated using JFormDesigner non-commercial license
private JButton parcourirButton;
private JTextField textField1;
private JTextField textField2;
private JTextField textField3;
private JTextField textField4;
private JList labels;
private JPanel imagePanel;
private JButton saveAsButton;
private JButton reloadButton;
private JButton saveButton;
private JList listImages;
private JList rectangles;
private JButton precedentButton;
private JButton suivantButton;
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
}
*/