Created
October 18, 2018 20:22
-
-
Save drelagreen/3a178b9d9a1a4a774939f9d374050de6 to your computer and use it in GitHub Desktop.
NetworkChat 1.0 (not green)
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 v1_0b_; | |
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
public class Graph extends JFrame { | |
JTextField jj; | |
Graph(){ | |
setResizable(false); | |
setTitle(Kek.VERSION); | |
setSize(500,500); | |
setVisible(true); | |
setDefaultCloseOperation(EXIT_ON_CLOSE); | |
JLabel label = new JLabel("Welcome to SAMBEKChat webEd(0.2b)"); | |
label.setFont(new Font("Monaco", Font.PLAIN, 27)); | |
JTextField login = new JTextField(10); | |
JPasswordField password = new JPasswordField(10); | |
JButton ok = new JButton("OK"); | |
// ok.setSize(50,50); | |
JButton cancel = new JButton("CANCEL"); | |
// cancel.setSize(50,50); | |
setLocationRelativeTo(password); | |
JPanel panel1 = new JPanel();panel1.setLayout(new GridLayout(12,1)); | |
panel1.setSize(500,500); | |
panel1.add(new JLabel("Разметка немножко в говно, я с ней разберусь...позже")); | |
panel1.add(label); | |
panel1.add(new JLabel(" Login:")); | |
panel1.add(login); | |
panel1.add(new JLabel(" Password:")); | |
panel1.add(password); | |
panel1.add(new JLabel(" IP:")); | |
JTextField ipField = new JTextField(10); | |
panel1.add(ipField); | |
panel1.add(ok); | |
panel1.add(cancel); | |
ipField.setFont(new Font("Monaco", Font.PLAIN, 20)); | |
login.setFont(new Font("Monaco", Font.PLAIN, 20)); | |
password.setFont(new Font("Monaco", Font.PLAIN, 20)); | |
jj = new JTextField(10); | |
panel1.add(jj); | |
jj.setEditable(false); | |
setContentPane(panel1); | |
ok.addActionListener(new ActionListener() { | |
@Override | |
public void actionPerformed(ActionEvent e) { | |
if (!login.getText().equals("") &&password.getPassword()!=null&& !ipField.getText().equals("")) | |
Kek.login(login.getText(),password.getPassword(),ipField.getText()); | |
if (Kek.isConnected) {jj.setText(":) Загрузка..."); Kek.turn2(); } else { | |
jj.setText(":( Подключение не удалось "); | |
} | |
ok.setEnabled(true); | |
cancel.setEnabled(true); | |
} | |
}); | |
KeyListener kl = new KeyListener() { | |
@Override | |
public void keyTyped(KeyEvent e) { | |
} | |
@Override | |
public void keyPressed(KeyEvent e) { | |
if (e.getKeyCode()==KeyEvent.VK_ENTER){ | |
ok.doClick(); | |
} | |
} | |
@Override | |
public void keyReleased(KeyEvent e) { | |
} | |
}; | |
ipField.addKeyListener(kl); | |
password.addKeyListener(kl); | |
login.addKeyListener(kl); | |
cancel.addActionListener(new ActionListener() { | |
@Override | |
public void actionPerformed(ActionEvent e) { | |
System.exit(0); | |
} | |
}); | |
} | |
} |
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 v1_0b_; | |
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
import static java.awt.event.KeyEvent.VK_ENTER; | |
/** | |
* @author Drelgreen | |
* @// TODO: 16.10.2018 textArea1 - chat; textArea2 - mArea; textArea3 - info; b1 - button | |
* | |
* | |
*/ | |
public class Graph2 extends Gu { | |
JDialog jDialog = new JDialog(); | |
Graph2(){ | |
setTitle(Kek.VERSION); | |
setVisible(true); | |
setSize(610,650); | |
setBackground(new Color(0xB7F8AF)); | |
setResizable(true); | |
setDefaultCloseOperation(EXIT_ON_CLOSE); | |
b1.addActionListener(event -> vector()); | |
textArea2.addKeyListener(new KeyListener() { | |
@Override | |
public void keyTyped(KeyEvent e) { | |
} | |
@Override | |
public void keyPressed(KeyEvent e) { | |
if (e.getKeyCode()== VK_ENTER&&!e.isShiftDown()){ | |
b1.doClick(); | |
} | |
if (e.getKeyCode()== VK_ENTER&&e.isShiftDown()){ | |
textArea2.setText(textArea2.getText()+"\n"); | |
} | |
} | |
@Override | |
public void keyReleased(KeyEvent e) { | |
if (e.getKeyCode()== VK_ENTER&&!e.isShiftDown()){ | |
textArea2.setText(null); | |
} | |
} | |
}); | |
this.setLocationRelativeTo(null); | |
} | |
public void print(String text) { | |
textArea1.setText(textArea1.getText() + "\n" + text); | |
} | |
void print2(String text){ | |
textArea3.setText(text); | |
} | |
public String writeM() { | |
String text; | |
text = textArea2.getText(); | |
textArea2.setText(null); | |
return text; | |
} | |
public void vector() { | |
String text = writeM(); | |
String[] t = text.split(""); | |
if (t[0].equals("/")) { | |
String x = ""; | |
for (int i = 1; i<t.length; i++){ | |
x+=t[i]; | |
} | |
sChecker(x); | |
} else { | |
print(Kek.nickname+" > "+text); | |
Kek.outToServer(text); | |
} | |
} | |
public void sChecker(String text){ | |
} | |
void mda(){ | |
progressBar1.setMaximum(10000); | |
new Thread(() -> { | |
while(true){ | |
if (progressBar1.getValue()==10000) progressBar1.setValue(0); | |
progressBar1.setValue(progressBar1.getValue()+1); | |
try { | |
Thread.sleep(25); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
} | |
}).start(); | |
} | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="v1_0b_.Gu"> | |
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="GridBagLayout"> | |
<constraints> | |
<xy x="139" y="96" width="1076" height="455"/> | |
</constraints> | |
<properties> | |
<background color="-1319"/> | |
</properties> | |
<border type="none"/> | |
<children> | |
<grid id="499c1" binding="jp1" layout-manager="GridBagLayout"> | |
<constraints> | |
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="3.0" weighty="16.0"/> | |
</constraints> | |
<properties/> | |
<border type="none"/> | |
<children> | |
<scrollpane id="8ac18"> | |
<constraints> | |
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="1.0" weighty="1.0"/> | |
</constraints> | |
<properties/> | |
<border type="none"/> | |
<children> | |
<component id="fa532" class="javax.swing.JTextArea" binding="textArea1" default-binding="true"> | |
<constraints/> | |
<properties> | |
<background color="-2097158"/> | |
<font name="Times New Roman" size="18" style="0"/> | |
</properties> | |
</component> | |
</children> | |
</scrollpane> | |
</children> | |
</grid> | |
<grid id="29748" binding="jp2" layout-manager="GridBagLayout"> | |
<constraints> | |
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="0.1" weighty="1.0"/> | |
</constraints> | |
<properties> | |
<background color="-1319"/> | |
</properties> | |
<border type="none"/> | |
<children> | |
<component id="bf99" class="javax.swing.JProgressBar" binding="progressBar1" default-binding="true"> | |
<constraints> | |
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="10.0" weighty="5.0"/> | |
</constraints> | |
<properties> | |
<background color="-5137"/> | |
<borderPainted value="true"/> | |
<foreground color="-16716801"/> | |
<indeterminate value="false"/> | |
</properties> | |
</component> | |
<component id="a50a4" class="javax.swing.JLabel"> | |
<constraints> | |
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="0.1" weighty="0.1"/> | |
</constraints> | |
<properties> | |
<text value=" "/> | |
</properties> | |
</component> | |
</children> | |
</grid> | |
<grid id="d1bca" binding="jp3" layout-manager="GridBagLayout"> | |
<constraints> | |
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="0.1" weighty="2.0"/> | |
</constraints> | |
<properties> | |
<background color="-1319"/> | |
</properties> | |
<border type="none"/> | |
<children> | |
<component id="29682" class="javax.swing.JTextArea" binding="textArea3" default-binding="true"> | |
<constraints> | |
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"> | |
<preferred-size width="150" height="50"/> | |
</grid> | |
<gridbag weightx="1.0" weighty="1.0"/> | |
</constraints> | |
<properties> | |
<background color="-1576990"/> | |
<font name="Consolas" size="11" style="2"/> | |
</properties> | |
</component> | |
<component id="288b6" class="javax.swing.JLabel"> | |
<constraints> | |
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="0.1" weighty="0.1"/> | |
</constraints> | |
<properties> | |
<text value=" "/> | |
</properties> | |
</component> | |
<component id="f8936" class="javax.swing.JLabel"> | |
<constraints> | |
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="0.1" weighty="0.1"/> | |
</constraints> | |
<properties> | |
<text value=" "/> | |
</properties> | |
</component> | |
<component id="63dce" class="javax.swing.JLabel"> | |
<constraints> | |
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="1.0E-8" weighty="0.0"/> | |
</constraints> | |
<properties> | |
<text value=" "/> | |
</properties> | |
</component> | |
</children> | |
</grid> | |
<grid id="948a" binding="jp4" layout-manager="GridBagLayout"> | |
<constraints> | |
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="0.2" weighty="2.0"/> | |
</constraints> | |
<properties> | |
<background color="-1319"/> | |
</properties> | |
<border type="none"/> | |
<children/> | |
</grid> | |
<grid id="6aab" binding="jp6" layout-manager="GridBagLayout"> | |
<constraints> | |
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="0.1" weighty="3.0"/> | |
</constraints> | |
<properties> | |
<background color="-1319"/> | |
</properties> | |
<border type="none"/> | |
<children> | |
<component id="23e1b" class="javax.swing.JLabel"> | |
<constraints> | |
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="0.0" weighty="0.01"/> | |
</constraints> | |
<properties> | |
<text value=" "/> | |
</properties> | |
</component> | |
<scrollpane id="48fd"> | |
<constraints> | |
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="1.0" weighty="1.0"/> | |
</constraints> | |
<properties/> | |
<border type="none"/> | |
<children> | |
<component id="ff8e8" class="javax.swing.JTextArea" binding="textArea2" default-binding="true"> | |
<constraints/> | |
<properties> | |
<background color="-2097158"/> | |
<font name="Arial" size="16" style="0"/> | |
</properties> | |
</component> | |
</children> | |
</scrollpane> | |
</children> | |
</grid> | |
<component id="7ff86" class="javax.swing.JButton" binding="b1"> | |
<constraints> | |
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/> | |
<gridbag top="0" left="0" bottom="40" right="0" weightx="0.0" weighty="2.0" ipady="10"/> | |
</constraints> | |
<properties> | |
<background color="-1792"/> | |
<horizontalTextPosition value="0"/> | |
<text value=">>"/> | |
</properties> | |
</component> | |
<hspacer id="3a38a"> | |
<constraints> | |
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="0.01" weighty="0.0"/> | |
</constraints> | |
</hspacer> | |
<component id="7a8e9" class="javax.swing.JLabel"> | |
<constraints> | |
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> | |
<gridbag weightx="1.0" weighty="1.0" ipadx="5"/> | |
</constraints> | |
<properties> | |
<font name="Arial Black" size="14" style="3"/> | |
<foreground color="-4519932"/> | |
<text value="SAMBEKChat V 1.0b (SE)"/> | |
</properties> | |
</component> | |
</children> | |
</grid> | |
</form> |
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 v1_0b_; | |
import javax.swing.*; | |
import java.awt.*; | |
public class Gu extends JFrame { | |
Gu() { | |
getContentPane().add(panel1); | |
setVisible(true); | |
} | |
JPanel panel1; | |
JPanel jp1; | |
JPanel jp2; | |
JPanel jp3; | |
JPanel jp4; | |
JPanel jp6; | |
JButton b1; | |
JTextArea textArea1; | |
JTextArea textArea3; | |
JTextArea textArea2; | |
JProgressBar progressBar1; | |
public void setData(Gu data) { | |
} | |
public void getData(Gu data) { | |
} | |
public boolean isModified(Gu data) { | |
return false; | |
} | |
{ | |
// GUI initializer generated by IntelliJ IDEA GUI Designer | |
// >>> IMPORTANT!! <<< | |
// DO NOT EDIT OR ADD ANY CODE HERE! | |
$$$setupUI$$$(); | |
} | |
/** | |
* Method generated by IntelliJ IDEA GUI Designer | |
* >>> IMPORTANT!! <<< | |
* DO NOT edit this method OR call it in your code! | |
* | |
* @noinspection ALL | |
*/ | |
private void $$$setupUI$$$() { | |
panel1 = new JPanel(); | |
panel1.setLayout(new GridBagLayout()); | |
panel1.setBackground(new Color(-1319)); | |
jp1 = new JPanel(); | |
jp1.setLayout(new GridBagLayout()); | |
GridBagConstraints gbc; | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 1; | |
gbc.gridy = 1; | |
gbc.weightx = 3.0; | |
gbc.weighty = 16.0; | |
gbc.fill = GridBagConstraints.BOTH; | |
panel1.add(jp1, gbc); | |
final JScrollPane scrollPane1 = new JScrollPane(); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 0; | |
gbc.gridy = 0; | |
gbc.weightx = 1.0; | |
gbc.weighty = 1.0; | |
gbc.fill = GridBagConstraints.BOTH; | |
jp1.add(scrollPane1, gbc); | |
textArea1 = new JTextArea(); | |
textArea1.setBackground(new Color(-2097158)); | |
Font textArea1Font = this.$$$getFont$$$("Times New Roman", Font.PLAIN, 18, textArea1.getFont()); | |
if (textArea1Font != null) textArea1.setFont(textArea1Font); | |
scrollPane1.setViewportView(textArea1); | |
jp2 = new JPanel(); | |
jp2.setLayout(new GridBagLayout()); | |
jp2.setBackground(new Color(-1319)); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 1; | |
gbc.gridy = 2; | |
gbc.weightx = 0.1; | |
gbc.weighty = 1.0; | |
gbc.fill = GridBagConstraints.BOTH; | |
panel1.add(jp2, gbc); | |
progressBar1 = new JProgressBar(); | |
progressBar1.setBackground(new Color(-5137)); | |
progressBar1.setBorderPainted(true); | |
progressBar1.setForeground(new Color(-16716801)); | |
progressBar1.setIndeterminate(false); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 0; | |
gbc.gridy = 0; | |
gbc.weightx = 10.0; | |
gbc.weighty = 5.0; | |
gbc.fill = GridBagConstraints.HORIZONTAL; | |
jp2.add(progressBar1, gbc); | |
final JLabel label1 = new JLabel(); | |
label1.setText(" "); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 0; | |
gbc.gridy = 1; | |
gbc.weightx = 0.1; | |
gbc.weighty = 0.1; | |
gbc.fill = GridBagConstraints.VERTICAL; | |
jp2.add(label1, gbc); | |
jp3 = new JPanel(); | |
jp3.setLayout(new GridBagLayout()); | |
jp3.setBackground(new Color(-1319)); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 2; | |
gbc.gridy = 1; | |
gbc.weightx = 0.1; | |
gbc.weighty = 2.0; | |
gbc.fill = GridBagConstraints.BOTH; | |
panel1.add(jp3, gbc); | |
textArea3 = new JTextArea(); | |
textArea3.setBackground(new Color(-1576990)); | |
Font textArea3Font = this.$$$getFont$$$("Consolas", Font.ITALIC, 11, textArea3.getFont()); | |
if (textArea3Font != null) textArea3.setFont(textArea3Font); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 1; | |
gbc.gridy = 1; | |
gbc.weightx = 1.0; | |
gbc.weighty = 1.0; | |
gbc.fill = GridBagConstraints.BOTH; | |
jp3.add(textArea3, gbc); | |
final JLabel label2 = new JLabel(); | |
label2.setText(" "); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 1; | |
gbc.gridy = 0; | |
gbc.weightx = 0.1; | |
gbc.weighty = 0.1; | |
gbc.fill = GridBagConstraints.VERTICAL; | |
jp3.add(label2, gbc); | |
final JLabel label3 = new JLabel(); | |
label3.setText(" "); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 1; | |
gbc.gridy = 2; | |
gbc.weightx = 0.1; | |
gbc.weighty = 0.1; | |
gbc.fill = GridBagConstraints.VERTICAL; | |
jp3.add(label3, gbc); | |
final JLabel label4 = new JLabel(); | |
label4.setText(" "); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 0; | |
gbc.gridy = 1; | |
gbc.weightx = 1.0E-8; | |
gbc.anchor = GridBagConstraints.WEST; | |
jp3.add(label4, gbc); | |
jp4 = new JPanel(); | |
jp4.setLayout(new GridBagLayout()); | |
jp4.setBackground(new Color(-1319)); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 0; | |
gbc.gridy = 1; | |
gbc.weightx = 0.2; | |
gbc.weighty = 2.0; | |
gbc.fill = GridBagConstraints.BOTH; | |
panel1.add(jp4, gbc); | |
jp6 = new JPanel(); | |
jp6.setLayout(new GridBagLayout()); | |
jp6.setBackground(new Color(-1319)); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 1; | |
gbc.gridy = 3; | |
gbc.weightx = 0.1; | |
gbc.weighty = 3.0; | |
gbc.fill = GridBagConstraints.BOTH; | |
panel1.add(jp6, gbc); | |
final JLabel label5 = new JLabel(); | |
label5.setText(" "); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 0; | |
gbc.gridy = 1; | |
gbc.weighty = 0.01; | |
gbc.fill = GridBagConstraints.VERTICAL; | |
jp6.add(label5, gbc); | |
final JScrollPane scrollPane2 = new JScrollPane(); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 0; | |
gbc.gridy = 0; | |
gbc.weightx = 1.0; | |
gbc.weighty = 1.0; | |
gbc.fill = GridBagConstraints.BOTH; | |
jp6.add(scrollPane2, gbc); | |
textArea2 = new JTextArea(); | |
textArea2.setBackground(new Color(-2097158)); | |
Font textArea2Font = this.$$$getFont$$$("Arial", Font.PLAIN, 16, textArea2.getFont()); | |
if (textArea2Font != null) textArea2.setFont(textArea2Font); | |
scrollPane2.setViewportView(textArea2); | |
b1 = new JButton(); | |
b1.setBackground(new Color(-1792)); | |
b1.setHorizontalTextPosition(0); | |
b1.setText(">>"); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 2; | |
gbc.gridy = 3; | |
gbc.weighty = 2.0; | |
gbc.ipady = 10; | |
gbc.insets = new Insets(0, 0, 40, 0); | |
panel1.add(b1, gbc); | |
final JPanel spacer1 = new JPanel(); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 3; | |
gbc.gridy = 1; | |
gbc.weightx = 0.01; | |
gbc.fill = GridBagConstraints.HORIZONTAL; | |
panel1.add(spacer1, gbc); | |
final JLabel label6 = new JLabel(); | |
Font label6Font = this.$$$getFont$$$("Arial Black", Font.BOLD | Font.ITALIC, 14, label6.getFont()); | |
if (label6Font != null) label6.setFont(label6Font); | |
label6.setForeground(new Color(-4519932)); | |
label6.setText("SAMBEKChat V 1.0b (SE)"); | |
gbc = new GridBagConstraints(); | |
gbc.gridx = 1; | |
gbc.gridy = 0; | |
gbc.weightx = 1.0; | |
gbc.weighty = 1.0; | |
gbc.fill = GridBagConstraints.VERTICAL; | |
gbc.ipadx = 5; | |
panel1.add(label6, gbc); | |
} | |
/** | |
* @noinspection ALL | |
*/ | |
private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { | |
if (currentFont == null) return null; | |
String resultName; | |
if (fontName == null) { | |
resultName = currentFont.getName(); | |
} else { | |
Font testFont = new Font(fontName, Font.PLAIN, 10); | |
if (testFont.canDisplay('a') && testFont.canDisplay('1')) { | |
resultName = fontName; | |
} else { | |
resultName = currentFont.getName(); | |
} | |
} | |
return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); | |
} | |
/** | |
* @noinspection ALL | |
*/ | |
public JComponent $$$getRootComponent$$$() { | |
return panel1; | |
} | |
} |
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 v1_0b_; | |
import java.io.DataInputStream; | |
import java.io.DataOutputStream; | |
import java.io.IOException; | |
import java.net.Socket; | |
import java.util.Arrays; | |
public class Kek { | |
public static final String VERSION = "SAMBEKChat v1.0b"; | |
static volatile Graph2 g2; | |
static String nickname = "Test"; | |
static Socket socket; | |
static DataInputStream dataInputStream; | |
static DataOutputStream dataOutputStream; | |
static boolean isConnected = false; | |
static Graph g = new Graph(); | |
public static void main(String[] args) { | |
} | |
public static void login(String log, char[] pas, String ip){ | |
System.out.println(log); | |
for (char c : pas) { | |
System.out.println(c); | |
} | |
int hash = Arrays.hashCode(pas); | |
System.out.println(hash); | |
try { | |
socket = new Socket(ip,7788); | |
dataInputStream = new DataInputStream(socket.getInputStream()); | |
dataOutputStream = new DataOutputStream(socket.getOutputStream()); | |
dataOutputStream.writeUTF(log+":"+hash); | |
isConnected = dataInputStream.readBoolean(); | |
if(!isConnected){socket = null; dataInputStream = null; dataOutputStream = null;} | |
} catch (IOException e) { | |
isConnected = false; | |
} | |
} | |
public static void turn2(){ | |
g2 = new Graph2(); | |
System.out.println("OK"); | |
g.setVisible(false); | |
g2.textArea1.setEditable(false); | |
g2.textArea3.setEditable(false); | |
sCom(); | |
g2.mda(); | |
} | |
public static void sCom(){ | |
new Thread(() -> { | |
while (true){ | |
try { | |
String s = dataInputStream.readUTF(); | |
System.out.println("new email"); | |
String t[] = s.split(""); | |
switch (t[0]){ | |
case ("1"): | |
StringBuilder x = new StringBuilder(); | |
t[0]=""; | |
for (String s1 : t) { | |
x.append(s1); | |
} | |
g2.print(x.toString()); | |
break; | |
case ("3"): | |
StringBuilder y = new StringBuilder(); | |
t[0]=""; | |
for (String s1 : t) { | |
y.append(s1); | |
} | |
g2.print2(y.toString()); | |
break; | |
case "N": | |
StringBuilder z = new StringBuilder(); | |
t[0]=""; | |
for (String s1 : t) { | |
z.append(s1); | |
} | |
nickname = z.toString(); | |
break; | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
break; | |
} | |
} | |
}).start(); | |
} | |
public static void outToServer(String text){ | |
try { | |
dataOutputStream.writeUTF(text); | |
System.out.println(text); | |
dataOutputStream.flush(); | |
} catch (IOException e) { | |
g2.print2("SERVERERROR"); | |
g2.progressBar1.setVisible(false); | |
} | |
} | |
} |
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 v1_0b_; | |
public class Test { | |
public static void main(String[] args) { | |
Kek.turn2(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment