Skip to main content
Commonmark migration
Source Link

##Java

Java

THE NUMBERS

I tried to golf/obfuscate it a little - as you can see I didn't try super hard. The program looks a lot better than the LICEcap gif.

import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;

public class N extends JFrame implements ActionListener {
    public static void main(String[] args) throws Exception {
        i=new ImageIcon(ImageIO.read(new URL("http://i.imgur.com/oMloP1J.jpg")));
        EventQueue.invokeLater(new Runnable() {public void run() {new N().setVisible(true);}});
    }
    static ImageIcon i;
    JPanel c;
    Rectangle r;
    public N() {
        JLabel a=new JLabel(i);
        JLabel b=new JLabel(i);
        c=new JPanel();
        c.setLayout(new BoxLayout(c,1));
        c.add(a);
        c.add(b);
        JScrollPane j=new JScrollPane(c,21,31);
        Dimension d=j.getPreferredSize();
        d.setSize(d.width,d.height/2+1);
        j.setPreferredSize(d);
        r=new Rectangle(d);
        JPanel t=new JPanel();
        t.add(j);
        setContentPane(t);
        setResizable(false);
        pack();
        setDefaultCloseOperation(3);
        new Timer(20,this).start();
    }
    public void actionPerformed(ActionEvent e) {
        r.translate(0,1);
        if(r.getY()==r.height)r.translate(0,-r.height);
        c.scrollRectToVisible(r);
    }
}

##Java

THE NUMBERS

I tried to golf/obfuscate it a little - as you can see I didn't try super hard. The program looks a lot better than the LICEcap gif.

import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;

public class N extends JFrame implements ActionListener {
    public static void main(String[] args) throws Exception {
        i=new ImageIcon(ImageIO.read(new URL("http://i.imgur.com/oMloP1J.jpg")));
        EventQueue.invokeLater(new Runnable() {public void run() {new N().setVisible(true);}});
    }
    static ImageIcon i;
    JPanel c;
    Rectangle r;
    public N() {
        JLabel a=new JLabel(i);
        JLabel b=new JLabel(i);
        c=new JPanel();
        c.setLayout(new BoxLayout(c,1));
        c.add(a);
        c.add(b);
        JScrollPane j=new JScrollPane(c,21,31);
        Dimension d=j.getPreferredSize();
        d.setSize(d.width,d.height/2+1);
        j.setPreferredSize(d);
        r=new Rectangle(d);
        JPanel t=new JPanel();
        t.add(j);
        setContentPane(t);
        setResizable(false);
        pack();
        setDefaultCloseOperation(3);
        new Timer(20,this).start();
    }
    public void actionPerformed(ActionEvent e) {
        r.translate(0,1);
        if(r.getY()==r.height)r.translate(0,-r.height);
        c.scrollRectToVisible(r);
    }
}

Java

THE NUMBERS

I tried to golf/obfuscate it a little - as you can see I didn't try super hard. The program looks a lot better than the LICEcap gif.

import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;

public class N extends JFrame implements ActionListener {
    public static void main(String[] args) throws Exception {
        i=new ImageIcon(ImageIO.read(new URL("http://i.imgur.com/oMloP1J.jpg")));
        EventQueue.invokeLater(new Runnable() {public void run() {new N().setVisible(true);}});
    }
    static ImageIcon i;
    JPanel c;
    Rectangle r;
    public N() {
        JLabel a=new JLabel(i);
        JLabel b=new JLabel(i);
        c=new JPanel();
        c.setLayout(new BoxLayout(c,1));
        c.add(a);
        c.add(b);
        JScrollPane j=new JScrollPane(c,21,31);
        Dimension d=j.getPreferredSize();
        d.setSize(d.width,d.height/2+1);
        j.setPreferredSize(d);
        r=new Rectangle(d);
        JPanel t=new JPanel();
        t.add(j);
        setContentPane(t);
        setResizable(false);
        pack();
        setDefaultCloseOperation(3);
        new Timer(20,this).start();
    }
    public void actionPerformed(ActionEvent e) {
        r.translate(0,1);
        if(r.getY()==r.height)r.translate(0,-r.height);
        c.scrollRectToVisible(r);
    }
}
Source Link
durron597
  • 4.8k
  • 1
  • 21
  • 49

##Java

THE NUMBERS

I tried to golf/obfuscate it a little - as you can see I didn't try super hard. The program looks a lot better than the LICEcap gif.

import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;

public class N extends JFrame implements ActionListener {
    public static void main(String[] args) throws Exception {
        i=new ImageIcon(ImageIO.read(new URL("http://i.imgur.com/oMloP1J.jpg")));
        EventQueue.invokeLater(new Runnable() {public void run() {new N().setVisible(true);}});
    }
    static ImageIcon i;
    JPanel c;
    Rectangle r;
    public N() {
        JLabel a=new JLabel(i);
        JLabel b=new JLabel(i);
        c=new JPanel();
        c.setLayout(new BoxLayout(c,1));
        c.add(a);
        c.add(b);
        JScrollPane j=new JScrollPane(c,21,31);
        Dimension d=j.getPreferredSize();
        d.setSize(d.width,d.height/2+1);
        j.setPreferredSize(d);
        r=new Rectangle(d);
        JPanel t=new JPanel();
        t.add(j);
        setContentPane(t);
        setResizable(false);
        pack();
        setDefaultCloseOperation(3);
        new Timer(20,this).start();
    }
    public void actionPerformed(ActionEvent e) {
        r.translate(0,1);
        if(r.getY()==r.height)r.translate(0,-r.height);
        c.scrollRectToVisible(r);
    }
}