/** * Copyright (c) 2014 Matthias Jaenicke <matthias.jaenicke@student.kit.edu>, * Matthias Plappert <undkc@student.kit.edu>, * Julien Duman <uncyc@student.kit.edu>, * Christian Dreher <uaeef@student.kit.edu>, * Wasilij Beskorovajnov <uajkm@student.kit.edu> and * Aydin Tekin <aydin.tekin@student.kit.edu> * * Released under the MIT license (refer to LICENSE.md) * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package edu.kit.iks.Cryptographics.DiffieHellman.Demonstration; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JLabel; import org.xnap.commons.i18n.I18n; import edu.kit.iks.CryptographicsLib.Configuration; import edu.kit.iks.CryptographicsLib.VisualizationView; /** * Explains one-way functions and visualizes them * * @author kai * */ public class OnewayView extends VisualizationView { /** * Localization instance */ private static I18n i18n = Configuration.getInstance().getI18n(OnewayView.class); /** hold the explanation string */ private JLabel onewayExplain; /** no help need here */ private String help = i18n.tr("No help"); /** explanation string */ private String explain = i18n.tr("To achive this, we use " + "something called one-way function. This function is easy to compute " + "in one direction, but difficult to reverse."); private static final long serialVersionUID = 6243104730541136349L; /** * Construct subcomponents and layout */ public OnewayView() { super(); GridBagLayout layout = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); this.setLayout(layout); gbc.gridx = 2; gbc.gridy = 2; gbc.weightx = 0.1; gbc.weighty = 0.1; layout.setConstraints(this.getNextButton(), gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.weightx = 0.1; gbc.weighty = 0.1; layout.setConstraints(this.getBackButton(), gbc); this.onewayExplain = new JLabel(); this.onewayExplain.setText("<html><div style=\"width:200px\">" + explain + "</div></html>"); gbc.gridx = 1; gbc.gridy = 1; gbc.weightx = 0.1; gbc.weighty = 0.1; this.add(onewayExplain, gbc); } /** * return help string * @return the help string */ public String getHelp() { return help ; } }